raz / test / run / mods / AsmNamed.raz

29 lines · 632 B · raw · history · last change a072a400

1(* What AsmName's code procedures name in another module: an exported
2 procedure and variable, and a procedure that isn't exported, which
3 test/err/AsmNameHidden may not name. *)
4module AsmNamed;
5import SYSTEM;
6
7var count*: I64; (* added to through its address, by lea *)
8
9(* x * 2, the target of a tail call *)
10proc twice*(x: I64): I64;
11begin
12 return x * 2;
13end;
14
15(* count's address, as raz takes it *)
16proc countAt*: ^I64;
17begin
18 return SYSTEM.ADR(count);
19end;
20
21(* not exported: another module's code may not name it *)
22proc hidden(x: I64): I64;
23begin
24 return x;
25end;
26
27begin
28 count := hidden(100);
29end AsmNamed.