1 This testcase verifies that the module namespace returned by a runtime 2 `import()` expression is correctly mapped to the module exports if the 3 imported module statically imports a module which in turn statically 4 imports further modules. 5 6 The exports of all transitively linked modules occupy the leading slots of 7 the shared export table, so the export offset of the dynamically imported 8 root module must account for the nested modules as well, not just for the 9 exports of its direct imports. 10 11 The dependency tree is: 12 13 root 14 + import: outer 15 + import: middle 16 + import: inner 17 18 -- Testcase -- 19 mod = import('outer'); 20 21 printf("m = %.J\n", mod); 22 printf("f() = %s, g() = %s\n", mod.f(), mod.g()); 23 -- End -- 24 25 -- File inner.uc -- 26 export const value = 5; 27 export function fn() { return "inner"; } 28 export function fn2() { return "inner2"; } 29 -- End -- 30 31 -- File middle.uc -- 32 import { fn } from 'inner'; 33 34 export const mvalue = 7; 35 export function mfn() { return "middle" + fn(); } 36 -- End -- 37 38 -- File outer.uc -- 39 import { mfn } from 'middle'; 40 41 export function f() { return "f"; } 42 export function g() { return mfn(); } 43 -- End -- 44 45 -- Args -- 46 -R -L files/ 47 -- End -- 48 49 -- Expect stdout -- 50 m = { 51 "f": "function f() { ... }", 52 "g": "function g() { ... }" 53 } 54 f() = f, g() = middleinner 55 -- End --
This page was automatically generated by LXR 0.3.1. • OpenWrt