1 This testcase verifies that the module namespace returned by a runtime 2 `import()` expression is correctly mapped to the module exports even if 3 the imported module itself statically imports another module at compile 4 time. 5 6 Since statically imported modules are linked into the same program, the 7 exports of the innermost modules occupy the leading slots of the shared 8 export table. The namespace builder must honor the per-source export 9 offset to avoid pairing symbol names with the wrong export entries. 10 11 The dependency tree is: 12 13 root 14 + import: outer 15 + import: inner 16 17 -- Testcase -- 18 mod = import('outer'); 19 20 printf("m = %.J\n", mod); 21 -- End -- 22 23 -- File inner.uc -- 24 export const value = 5; 25 export function fn() { return "inner"; } 26 -- End -- 27 28 -- File outer.uc -- 29 import { fn } from 'inner'; 30 31 const local = fn(); 32 33 export function f() { return "f"; } 34 export function g() { return "g"; } 35 -- End -- 36 37 -- Args -- 38 -R -L files/ 39 -- End -- 40 41 -- Expect stdout -- 42 m = { 43 "f": "function f() { ... }", 44 "g": "function g() { ... }" 45 } 46 -- End --
This page was automatically generated by LXR 0.3.1. • OpenWrt