aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/control_flow.nom2
-rw-r--r--core/metaprogramming.nom4
2 files changed, 3 insertions, 3 deletions
diff --git a/core/control_flow.nom b/core/control_flow.nom
index 1c3deaa..19a9186 100644
--- a/core/control_flow.nom
+++ b/core/control_flow.nom
@@ -484,7 +484,7 @@ test:
assume ((result of (: return 99)) == 99)
# Inline thunk:
-compile [result of %body] to (Lua value "(\(compile as ([] -> %body)))()")
+compile [result of %body] to (Lua value "\(compile as ([] -> %body))()")
test:
%t = [1, [2, [[3], 4], 5, [[[6]]]]]
%flat = []
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