nomsu/core/scopes.nom
Bruce Hill b12744d831 Some cleanup and fixes. Simplifying a lot of code, and extending the
flexibility of scoping. Redesigned Object system too.
2018-06-14 23:25:34 -07:00

31 lines
883 B
Plaintext

use "core/metaprogramming.nom"
use "core/operators.nom"
use "core/collections.nom"
use "core/control_flow.nom"
compile [with local %locals %body, with local %locals do %body] to
%body_lua <- (%body as lua statements)
when %locals.type = ?
* "Dict"
%body_lua <-
Lua ".."
\(=lua "A_assign_1(\%locals, \%locals)")
\%body_lua
declare locals
(%.1 as lua id) for % in %locals
.. in %body_lua
* "List"
declare locals
(% as lua id) for % in %locals
.. in %body_lua
* "Var"
* "Action"
declare locals [%locals as lua id] in %body_lua
* else
barf "Unexpected local: \(%locals as nomsu)"
return
Lua ".."
do
\%body_lua
end