aboutsummaryrefslogtreecommitdiff
path: root/core/metaprogramming.nom
diff options
context:
space:
mode:
authorBruce Hill <bitbucket@bruce-hill.com>2018-04-09 18:58:05 -0700
committerBruce Hill <bitbucket@bruce-hill.com>2018-04-09 18:58:27 -0700
commitd42d20c50ae0443e2ac5ffa6492ad57745e27830 (patch)
tree78585c98ee8f4a3c88179c0d6b38b7f4015571ad /core/metaprogramming.nom
parent86925c5b3a2c38ff47eb1764b04394b7d25cd13d (diff)
Re-added callstack callsite info. It's a bit hacky, but better than
nothing.
Diffstat (limited to 'core/metaprogramming.nom')
-rw-r--r--core/metaprogramming.nom5
1 files changed, 4 insertions, 1 deletions
diff --git a/core/metaprogramming.nom b/core/metaprogramming.nom
index 97f4ac1..7488ff8 100644
--- a/core/metaprogramming.nom
+++ b/core/metaprogramming.nom
@@ -5,7 +5,7 @@
# Compile-time action to make compile-time actions:
immediately:
lua> ".."
- nomsu:define_compile_action("compile %actions to %lua", \(!! code location !!), function(\%actions, \%lua)
+ nomsu:define_compile_action("compile %actions to %lua", \(!! code location !!), function(__callsite, \%actions, \%lua)
local stubs = {};
for i, action in ipairs(\%actions.value) do
stubs[i] = nomsu:tree_to_named_stub(action);
@@ -30,6 +30,7 @@ immediately:
if #undeclared_locals > 0 then
body_code = "local "..table.concat(undeclared_locals, ", ")..";\\n"..body_code;
end
+ table.insert(args, 1, "__callsite");
local lua_fn_args = table.concat(args, ", ");
local def_metadata = nomsu.tree_metadata[nomsu.compilestack[#nomsu.compilestack]];
local code_location = (def_metadata and ("%s:%s,%s"):format(def_metadata.filename, def_metadata.start, def_metadata.stop)
@@ -66,6 +67,7 @@ immediately:
if #undeclared_locals > 0 then
body_code = "local "..table.concat(undeclared_locals, ", ")..";\\n"..body_code;
end
+ table.insert(args, 1, "__callsite");
local lua_fn_args = table.concat(args, ", ");
local def_metadata = nomsu.tree_metadata[nomsu.compilestack[#nomsu.compilestack]];
local code_location = (def_metadata and ("%s:%s,%s"):format(def_metadata.filename, def_metadata.start, def_metadata.stop)
@@ -88,6 +90,7 @@ immediately:
for i,tok in ipairs(\%shorthand.value[1].value) do
if tok.type == "Var" then args[#args+1] = nomsu:var_to_lua_identifier(tok.value); end
end
+ table.insert(args, 1, "__callsite");
local lua_fn_args = table.concat(args, ", ");
local template;
if \%longhand.type == "Block" then