aboutsummaryrefslogtreecommitdiff
path: root/core/metaprogramming.nom
diff options
context:
space:
mode:
authorBruce Hill <bitbucket@bruce-hill.com>2018-06-12 18:04:18 -0700
committerBruce Hill <bitbucket@bruce-hill.com>2018-06-12 18:04:41 -0700
commit3c510e4ee5027aa5191e994bdf0a080a32a4b082 (patch)
treeb8d740f6ce0e263faa92967a63d16af07f3d45e7 /core/metaprogramming.nom
parentb5fb8933af283d2b873a03ded085e8b69f374e81 (diff)
Lots of optimizations and simplifications, especially towards getting
better performance on luajit.
Diffstat (limited to 'core/metaprogramming.nom')
-rw-r--r--core/metaprogramming.nom10
1 files changed, 4 insertions, 6 deletions
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