Fix for files getting run twice by (use "")

This commit is contained in:
Bruce Hill 2018-12-15 15:14:26 -08:00
parent 3036d425a5
commit 17fc0a0e38
2 changed files with 27 additions and 11 deletions

View File

@ -322,8 +322,15 @@ local nomsu_environment = Importer({
break
end
for _index_0 = 1, #files do
local _continue_1 = false
repeat
local filename = files[_index_0]
local lua_filename = filename:gsub("%.nom$", ".lua")
if environment.FILE_CACHE[filename] then
import_to_1_from(environment, environment.FILE_CACHE[filename], prefix)
_continue_1 = true
break
end
local code
if optimization ~= 0 and Files.read(lua_filename) then
local file = Files.read(lua_filename)
@ -334,6 +341,11 @@ local nomsu_environment = Importer({
end
environment.run_1_in(code, mod)
did_anything = true
_continue_1 = true
until true
if not _continue_1 then
break
end
end
break
end

View File

@ -179,6 +179,10 @@ nomsu_environment = Importer{
continue unless files
for filename in *files
lua_filename = filename\gsub("%.nom$", ".lua")
-- Need to check here to prevent re-running files
if environment.FILE_CACHE[filename]
import_to_1_from(environment, environment.FILE_CACHE[filename], prefix)
continue
-- TODO: don't automatically use precompiled version?
code = if optimization != 0 and Files.read(lua_filename)
-- TODO: use a checksum?