diff options
Diffstat (limited to 'core/metaprogramming.nom')
| -rw-r--r-- | core/metaprogramming.nom | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/core/metaprogramming.nom b/core/metaprogramming.nom index 21743ad..8a4d450 100644 --- a/core/metaprogramming.nom +++ b/core/metaprogramming.nom @@ -6,14 +6,14 @@ lua> "NOMSU_CORE_VERSION = 5" lua> ".." nomsu.COMPILE_ACTIONS["% -> %"] = function(nomsu, tree, \%args, \%body) - local lua = LuaCode.Value(tree.source, "function(") + local lua = LuaCode.Value(tree.source, "(function(") if AST.is_syntax_tree(\%args, "Action") then \%args = \%args:get_args() end local lua_args = table.map(\%args, function(a) return AST.is_syntax_tree(a) and tostring(nomsu:compile(a)) or a end) lua:concat_append(lua_args, ", ") local body_lua = AST.is_syntax_tree(\%body) and nomsu:compile(\%body):as_statements("return ") or \%body body_lua:remove_free_vars(lua_args) body_lua:declare_locals() - lua:append(")\\n ", body_lua, "\\nend") + lua:append(")\\n ", body_lua, "\\nend)") return lua end |
