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