1 Export statements are only allowed at the toplevel of a module. 2 3 -- Testcase -- 4 export let x = 1; 5 -- End -- 6 7 -- Args -- 8 -R 9 -- End -- 10 11 -- Expect stderr -- 12 Syntax error: Exports may only appear at top level of a module 13 In line 1, byte 1: 14 15 `export let x = 1;` 16 ^-- Near here 17 18 19 -- End -- 20 21 22 Export statements are not allowed within functions or nested blocks. 23 24 -- Testcase -- 25 import "./files/test.uc"; 26 -- End -- 27 28 -- File test.uc -- 29 { 30 export let x = 1; 31 } 32 -- End -- 33 34 -- Args -- 35 -R 36 -- End -- 37 38 -- Expect stderr -- 39 Syntax error: Unable to compile module './files/test.uc': 40 41 | Syntax error: Exports may only appear at top level of a module 42 | In ./files/test.uc, line 2, byte 2: 43 | 44 | ` export let x = 1;` 45 | ^-- Near here 46 47 In [stdin], line 1, byte 25: 48 49 `import "./files/test.uc";` 50 Near here --------------^ 51 52 53 -- End -- 54 55 56 Duplicate export names should result in an error. 57 58 -- Testcase -- 59 import "./files/test-duplicate.uc"; 60 -- End -- 61 62 -- File test-duplicate.uc -- 63 let x = 1, y = 2; 64 65 export { x }; 66 export { y as x }; 67 -- End -- 68 69 -- Args -- 70 -R 71 -- End -- 72 73 -- Expect stderr -- 74 Syntax error: Unable to compile module './files/test-duplicate.uc': 75 76 | Syntax error: Duplicate export 'x' for module './files/test-duplicate.uc' 77 | In ./files/test-duplicate.uc, line 4, byte 15: 78 | 79 | `export { y as x };` 80 | Near here ----^ 81 82 In [stdin], line 1, byte 35: 83 84 `import "./files/test-duplicate.uc";` 85 Near here ------------------------^ 86 87 88 -- End --
This page was automatically generated by LXR 0.3.1. • OpenWrt