• source navigation  • diff markup  • identifier search  • freetext search  • 

Sources/ucode/tests/custom/04_modules/05_export_default

  1 The `export default` statement can be used to declare a default export
  2 value for a module. The value for `export default` can be an arbitrary
  3 expression, it must not refer to a local variable.
  4 
  5 When using the export list syntax, the alias "default" can be used to
  6 designate the default export.
  7 
  8 -- File test-default-expr.uc --
  9 export default 7 * 21;
 10 -- End --
 11 
 12 -- File test-default-func.uc --
 13 export default function() {
 14         return "Hello, world!";
 15 };
 16 -- End --
 17 
 18 -- File test-default-alias.uc --
 19 let a = 1, b = 2, c = 3;
 20 
 21 export { a, b as default, c };
 22 -- End --
 23 
 24 -- Testcase --
 25 import def1 from "./files/test-default-expr.uc";
 26 import def2 from "./files/test-default-func.uc";
 27 import def3 from "./files/test-default-alias.uc";
 28 
 29 print([ def1, def2(), def3 ], "\n");
 30 -- End --
 31 
 32 -- Args --
 33 -R
 34 -- End --
 35 
 36 -- Expect stdout --
 37 [ 147, "Hello, world!", 2 ]
 38 -- End --

This page was automatically generated by LXR 0.3.1.  •  OpenWrt