1
0
Fork 0
mirror of https://github.com/Reuh/candran.git synced 2025-10-27 17:59:30 +00:00

Fix can handling of --import

This commit is contained in:
Étienne Fildadut 2021-06-18 15:30:23 +02:00
parent 56f1901f9b
commit 7b0563b9dc

View file

@ -118,19 +118,21 @@ else
print("Candran " .. candran.VERSION .. ", targeting " .. candran.default.target) print("Candran " .. candran.VERSION .. ", targeting " .. candran.default.target)
candran.setup() candran.setup()
-- only perform static imports once, on startup -- check errors in static import
-- note: static imports will be run every line, as preprocessors macros and constants aren't kept between compilations...
do do
local r, e = candran.load("local _", "stdin") local r, e = candran.load("local _", "stdin")
if not r then if not r then
print("In static import: "..e) print("In static import: "..e)
candran.default.import = {}
else else
r, e = pcall(r) r, e = pcall(r)
if not r then if not r then
print("In static import: "..e) print("In static import: "..e)
end
end
candran.default.import = {} candran.default.import = {}
end end
end
end
-- REPL loop -- REPL loop
local multiline = false -- true if wait for another line local multiline = false -- true if wait for another line