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:
parent
0eea4b80a6
commit
2cd910389b
14 changed files with 65 additions and 73 deletions
|
|
@ -1,11 +1,14 @@
|
|||
--# run #--
|
||||
--- text ---
|
||||
| {}"kk" |
|
||||
| {}"ko" |
|
||||
--- text ---
|
||||
| {}"" {}"42" {}"" |
|
||||
--- error ---
|
||||
[0m[31m[0m[31m[0m[31m[0m[31m./anselme/stdlib/closure.lua:15: no exported variable "y" defined in closure[0m
|
||||
↳ from [4mtest/tests/exported variable nested.ans:10:4[0m in call: [2mf . "y"[0m[0m
|
||||
↳ from [4mtest/tests/exported variable nested.ans:10:1[0m in text interpolation: [2m| {f . "y"} |[0m[0m
|
||||
↳ from [4mtest/tests/exported variable nested.ans:10:1[0m in translatable: [2m| {f . "y"} |[0m[0m
|
||||
[0m[31m[0m[31m[0m[31m[0m[31midentifier "z" is undefined in branch 6843ee85-cea8-445d-10f21-9a8e54372094[0m
|
||||
↳ from [4mtest/tests/exported variable nested.ans:12:3[0m in identifier: [2mz[0m[0m
|
||||
↳ from [4mtest/tests/exported variable nested.ans:12:1[0m in text interpolation: [2m| {z} |[0m[0m
|
||||
↳ from [4mtest/tests/exported variable nested.ans:12:1[0m in translatable: [2m| {z} |[0m[0m
|
||||
↳ from [4m?[0m in block: [2m:f = ($() _)…[0m
|
||||
--# saved #--
|
||||
{}
|
||||
|
|
@ -8,7 +8,7 @@
|
|||
--- text ---
|
||||
| {}"" {}"1" {}"" |
|
||||
--- text ---
|
||||
| {}"exported:" |
|
||||
| {}"upvalue:" |
|
||||
--- text ---
|
||||
| {}"" {}"1" {}"" |
|
||||
--- text ---
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@
|
|||
:@z = 12
|
||||
| ko
|
||||
|
||||
|{f.x}
|
||||
f!
|
||||
|
||||
|{f.y}
|
||||
|{x}
|
||||
|
||||
|{z}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
:f = $
|
||||
:@x = "ok"
|
||||
f!
|
||||
|
||||
f.x
|
||||
x
|
||||
|
|
@ -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!
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
:b = 5
|
||||
:$ a
|
||||
:@b = 5
|
||||
:b = 12
|
||||
|
||||
|a: {a.b}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
:$ f
|
||||
:@x = 5
|
||||
()
|
||||
|
||||
f.:x = 5
|
||||
|
||||
:a = f
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue