From 3c510e4ee5027aa5191e994bdf0a080a32a4b082 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Tue, 12 Jun 2018 18:04:18 -0700 Subject: Lots of optimizations and simplifications, especially towards getting better performance on luajit. --- core/metaprogramming.nom | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'core/metaprogramming.nom') diff --git a/core/metaprogramming.nom b/core/metaprogramming.nom index ec65f3e..e413191 100644 --- a/core/metaprogramming.nom +++ b/core/metaprogramming.nom @@ -82,7 +82,7 @@ immediately for i,tok in ipairs(\%shorthand[1]) do if tok.type == "Var" then local lua_var = tostring(nomsu:tree_to_lua(tok)) - replacements[tok.value] = lua_var + replacements[tok[1]] = lua_var lua:append(", ", lua_var) end end @@ -90,12 +90,10 @@ immediately local function make_tree(t) if type(t) ~= 'table' and type(t) ~= 'userdata' then return repr(t) - elseif t.type == 'Var' and replacements[t.value] then - return replacements[t.value] + elseif t.type == 'Var' and replacements[t[1]] then + return replacements[t[1]] elseif t.type == 'Var' then - return t.type.."("..repr(tostring(t.source))..", "..repr(t.value.."#"..tostring(MANGLE_INDEX))..")" - elseif t.value then - return t.type.."("..repr(tostring(t.source))..", "..repr(t.value)..")" + return t.type.."("..repr(tostring(t.source))..", "..repr(t[1].."#"..tostring(MANGLE_INDEX))..")" else local bits = {repr(tostring(t.source))} for i, entry in ipairs(t) do -- cgit v1.2.3