1
0
Fork 0
mirror of https://github.com/Reuh/anselme.git synced 2025-10-27 16:49:31 +00:00

Exported variables: no longer add export scope to every function, allow freely access and modifiy variable in function scope

Too many issues with predefining exported variables, and this is more flexible.
This commit is contained in:
Étienne Fildadut 2023-12-30 23:43:05 +01:00
parent 0eea4b80a6
commit 2cd910389b
14 changed files with 65 additions and 73 deletions

View file

@ -1,11 +1,14 @@
--# run #--
--- text ---
| {}"kk" |
| {}"ko" |
--- text ---
| {}"" {}"42" {}"" |
--- error ---
./anselme/stdlib/closure.lua:15: no exported variable "y" defined in closure
↳ from test/tests/exported variable nested.ans:10:4 in call: f . "y"
↳ from test/tests/exported variable nested.ans:10:1 in text interpolation: | {f . "y"} |
↳ from test/tests/exported variable nested.ans:10:1 in translatable: | {f . "y"} |
identifier "z" is undefined in branch 6843ee85-cea8-445d-10f21-9a8e54372094
↳ from test/tests/exported variable nested.ans:12:3 in identifier: z
↳ from test/tests/exported variable nested.ans:12:1 in text interpolation: | {z} |
↳ from test/tests/exported variable nested.ans:12:1 in translatable: | {z} |
↳ from ? in block: :f = ($() _)…
--# saved #--
{}

View file

@ -8,7 +8,7 @@
--- text ---
| {}"" {}"1" {}"" |
--- text ---
| {}"exported:" |
| {}"upvalue:" |
--- text ---
| {}"" {}"1" {}"" |
--- text ---

View file

@ -5,6 +5,8 @@
:@z = 12
| ko
|{f.x}
f!
|{f.y}
|{x}
|{z}

View file

@ -1,4 +1,5 @@
:f = $
:@x = "ok"
f!
f.x
x

View file

@ -6,11 +6,10 @@
a = a + 1
:$ g
:@a = 1
|{a}
a = a + 1
g.:a = 1
|local:
@ -20,7 +19,7 @@ f!
f!
|exported:
|upvalue:
g!

View file

@ -1,4 +1,5 @@
:b = 5
:$ a
:@b = 5
:b = 12
|a: {a.b}

View file

@ -1,5 +1,7 @@
:$ f
:@x = 5
()
f.:x = 5
:a = f