Reverted "use %" to expr-like behavior with return values preserved.
This commit is contained in:
parent
e8f9ef36d6
commit
f58dc0fcb7
@ -1352,13 +1352,15 @@ do
|
||||
}
|
||||
end)
|
||||
self:define_action("run file %filename", get_line_no(), function(_filename)
|
||||
return nomsu:run_file(_filename)
|
||||
return {
|
||||
expr = "nomsu:run_file(" .. tostring(nomsu:tree_to_lua(filename).expr) .. ")"
|
||||
}
|
||||
end)
|
||||
return self:define_compile_action("use %filename", get_line_no(), function(_filename)
|
||||
local filename = nomsu:tree_to_value(_filename)
|
||||
nomsu:require_file(filename)
|
||||
return {
|
||||
statements = "nomsu:require_file(" .. tostring(repr(filename)) .. ");"
|
||||
expr = "nomsu:require_file(" .. tostring(repr(filename)) .. ");"
|
||||
}
|
||||
end)
|
||||
end
|
||||
|
@ -929,12 +929,12 @@ class NomsuCompiler
|
||||
return expr: repr("#{tree.filename}:#{tree.start},#{tree.stop}")
|
||||
|
||||
@define_action "run file %filename", get_line_no!, (_filename)->
|
||||
nomsu\run_file(_filename)
|
||||
return expr:"nomsu:run_file(#{nomsu\tree_to_lua(filename).expr})"
|
||||
|
||||
@define_compile_action "use %filename", get_line_no!, (_filename)->
|
||||
filename = nomsu\tree_to_value(_filename)
|
||||
nomsu\require_file(filename)
|
||||
return statements:"nomsu:require_file(#{repr filename});"
|
||||
return expr:"nomsu:require_file(#{repr filename});"
|
||||
|
||||
-- Only run this code if this file was run directly with command line arguments, and not require()'d:
|
||||
if arg and debug.getinfo(2).func != require
|
||||
|
Loading…
Reference in New Issue
Block a user