forked from M-Labs/nac3
1
0
Fork 0

[standalone] Add demo for global variables

This commit is contained in:
David Mak 2024-10-04 13:16:26 +08:00
parent 746329ec5d
commit 581b2f7bb2
1 changed files with 31 additions and 0 deletions

View File

@ -0,0 +1,31 @@
@extern
def output_int32(x: int32):
...
@extern
def output_int64(x: int64):
...
X: int32 = 0
Y: int64 = int64(1)
def f():
global X, Y
X = 1
Y = int64(2)
def run() -> int32:
global X, Y
output_int32(X)
output_int64(Y)
f()
output_int32(X)
output_int64(Y)
X = 0
Y = int64(0)
output_int32(X)
output_int64(Y)
return 0