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

Sources/ucode/tests/custom/04_modules/12_import_immutability

  1 Module imports are read-only bindings to the exported module variables.
  2 
  3 -- Testcase --
  4 import { a } from "./files/test.uc";
  5 
  6 a = 2;
  7 -- End --
  8 
  9 -- File test.uc --
 10 export let a = 1;
 11 -- End --
 12 
 13 -- Args --
 14 -R
 15 -- End --
 16 
 17 -- Expect stderr --
 18 Syntax error: Invalid assignment to constant 'a'
 19 In [stdin], line 3, byte 5:
 20 
 21  `a = 2;`
 22       ^-- Near here
 23 
 24 
 25 -- End --
 26 
 27 
 28 Aggregated module objects are read-only as well.
 29 
 30 -- Testcase --
 31 import * as mod from "./files/test.uc";
 32 
 33 mod.a = 2;
 34 -- End --
 35 
 36 -- File test.uc --
 37 export let a = 1;
 38 -- End --
 39 
 40 -- Args --
 41 -R
 42 -- End --
 43 
 44 -- Expect stderr --
 45 Type error: object value is immutable
 46 In line 3, byte 9:
 47 
 48  `mod.a = 2;`
 49           ^-- Near here
 50 
 51 
 52 -- End --

This page was automatically generated by LXR 0.3.1.  •  OpenWrt