diff options
| author | Bruce Hill <bitbucket@bruce-hill.com> | 2018-07-24 13:39:04 -0700 |
|---|---|---|
| committer | Bruce Hill <bitbucket@bruce-hill.com> | 2018-07-24 13:39:04 -0700 |
| commit | 723eb9e1f169fb2d1b19d53f48fe542edd7fc510 (patch) | |
| tree | 95cf9b53fb41bc850a264d3ee6240b545c438235 /core/metaprogramming.nom | |
| parent | ca653cbb84802d0eb644d54d957501100586bea8 (diff) | |
Added parens around lambdas (% -> %), and removed them from 'result %'
correspondingly.
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 |
