1 This testcase verifies that the dynamic load an import compiles to 2 carries the source position of the import statement. 3 4 The compiler emitted the dynamic load at source position 0, so a stack 5 trace through a module that raised during the load pointed at the start 6 of the import statement instead of the module name. 7 8 -- Testcase -- 9 let fn = loadstring('let x = 1;\n\nimport { a } from "raiser";\n', { 10 raw_mode: true, 11 force_dynlink_list: [ 'raiser' ] 12 }); 13 14 try { 15 fn(); 16 } 17 catch (e) { 18 for (let frame in slice(e.stacktrace, 0, 2)) 19 printf("%s:%d:%d\n", frame.filename, frame.line, frame.byte); 20 } 21 -- End -- 22 23 -- File raiser.uc -- 24 export const a = 1; 25 26 die("raised in module"); 27 -- End -- 28 29 -- Args -- 30 -R -L files/ 31 -- End -- 32 33 -- Expect stdout -- 34 files/raiser.uc:3:23 35 [loadstring argument]:3:19 36 -- End --
This page was automatically generated by LXR 0.3.1. • OpenWrt