From c1cba45968b8d5e993fb12fcd7dae9192fbe6d79 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Mon, 17 Sep 2018 15:29:48 -0700 Subject: Added support for compile actions returning trees, and compiling blocks into values. --- core/metaprogramming.nom | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'core/metaprogramming.nom') diff --git a/core/metaprogramming.nom b/core/metaprogramming.nom index 5d31c2b..c50f783 100644 --- a/core/metaprogramming.nom +++ b/core/metaprogramming.nom @@ -197,16 +197,14 @@ compile [parse %actions as %body] to (..) end local \%new_body = LuaCode(\%body.source, "local mangle = mangler()", - "\\nlocal tree = ", make_tree(\%body), - "\\nlocal lua = nomsu:compile(tree)", - "\\nreturn lua") + "\\nreturn ", make_tree(\%body)) local ret = \(compile as (compile %actions to %new_body)) return ret" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # TODO: add check for .is_value -compile [%tree as lua expr] to (Lua value "nomsu:compile(\(=lua "nomsu:compile(\%tree)"))") +compile [%tree as lua expr] to (Lua value "nomsu:compile(\(=lua "nomsu:compile(\%tree, nil, true)"), nil, true)") ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- cgit v1.2.3