Fixed -O optimization flag.
This commit is contained in:
parent
9b6caad828
commit
b918668f18
@ -136,9 +136,9 @@ if not args or args.help then
|
|||||||
os.exit(EXIT_FAILURE)
|
os.exit(EXIT_FAILURE)
|
||||||
end
|
end
|
||||||
nomsu_environment.command_line_args = List(args.nomsu_args)
|
nomsu_environment.command_line_args = List(args.nomsu_args)
|
||||||
nomsu_environment.optimization = args.optimization or 1
|
nomsu_environment.OPTIMIZATION = tonumber(args.optimization or 1)
|
||||||
if args.version then
|
if args.version then
|
||||||
nomsu_environment.run_file_1_in('core', nomsu_environment)
|
nomsu_environment.run_file_1_in('core', nomsu_environment, nomsu_environment.OPTIMIZATION)
|
||||||
nomsu_environment.run_1_in([[say (Nomsu version)]], nomsu_environment)
|
nomsu_environment.run_1_in([[say (Nomsu version)]], nomsu_environment)
|
||||||
os.exit(EXIT_SUCCESS)
|
os.exit(EXIT_SUCCESS)
|
||||||
end
|
end
|
||||||
@ -167,7 +167,7 @@ run = function()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
if not (args.no_core) then
|
if not (args.no_core) then
|
||||||
nomsu_environment.run_file_1_in('core', nomsu_environment)
|
nomsu_environment.run_file_1_in('core', nomsu_environment, nomsu_environment.OPTIMIZATION)
|
||||||
end
|
end
|
||||||
for _index_0 = 1, #file_queue do
|
for _index_0 = 1, #file_queue do
|
||||||
local f = file_queue[_index_0]
|
local f = file_queue[_index_0]
|
||||||
@ -239,7 +239,7 @@ run = function()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
if not (args.primary_file or args.exec_strings) then
|
if not (args.primary_file or args.exec_strings) then
|
||||||
return nomsu_environment.run_file_1_in("tools/repl.nom", nomsu_environment)
|
return nomsu_environment.run_file_1_in("tools/repl.nom", nomsu_environment, nomsu_environment.OPTIMIZATION)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local debugger
|
local debugger
|
||||||
|
@ -89,10 +89,10 @@ if not args or args.help
|
|||||||
print usage
|
print usage
|
||||||
os.exit(EXIT_FAILURE)
|
os.exit(EXIT_FAILURE)
|
||||||
nomsu_environment.command_line_args = List(args.nomsu_args)
|
nomsu_environment.command_line_args = List(args.nomsu_args)
|
||||||
nomsu_environment.optimization = args.optimization or 1
|
nomsu_environment.OPTIMIZATION = tonumber(args.optimization or 1)
|
||||||
|
|
||||||
if args.version
|
if args.version
|
||||||
nomsu_environment.run_file_1_in 'core', nomsu_environment
|
nomsu_environment.run_file_1_in 'core', nomsu_environment, nomsu_environment.OPTIMIZATION
|
||||||
nomsu_environment.run_1_in([[say (Nomsu version)]], nomsu_environment)
|
nomsu_environment.run_1_in([[say (Nomsu version)]], nomsu_environment)
|
||||||
os.exit(EXIT_SUCCESS)
|
os.exit(EXIT_SUCCESS)
|
||||||
|
|
||||||
@ -108,7 +108,7 @@ run = ->
|
|||||||
input_files[filename] = true
|
input_files[filename] = true
|
||||||
|
|
||||||
unless args.no_core
|
unless args.no_core
|
||||||
nomsu_environment.run_file_1_in 'core', nomsu_environment
|
nomsu_environment.run_file_1_in 'core', nomsu_environment, nomsu_environment.OPTIMIZATION
|
||||||
|
|
||||||
for f in *file_queue
|
for f in *file_queue
|
||||||
for _,filename in Files.walk(f)
|
for _,filename in Files.walk(f)
|
||||||
@ -152,7 +152,7 @@ run = ->
|
|||||||
nomsu_environment.run_file_1_in(filename, nomsu_environment, 0)
|
nomsu_environment.run_file_1_in(filename, nomsu_environment, 0)
|
||||||
|
|
||||||
unless args.primary_file or args.exec_strings
|
unless args.primary_file or args.exec_strings
|
||||||
nomsu_environment.run_file_1_in("tools/repl.nom", nomsu_environment)
|
nomsu_environment.run_file_1_in("tools/repl.nom", nomsu_environment, nomsu_environment.OPTIMIZATION)
|
||||||
|
|
||||||
debugger = if args.debugger == "nil" then {}
|
debugger = if args.debugger == "nil" then {}
|
||||||
else require(args.debugger or 'error_handling')
|
else require(args.debugger or 'error_handling')
|
||||||
|
@ -136,7 +136,7 @@ local compile = setmetatable({
|
|||||||
return compile.action["lua >"](compile, code)
|
return compile.action["lua >"](compile, code)
|
||||||
end,
|
end,
|
||||||
["use"] = function(compile, path)
|
["use"] = function(compile, path)
|
||||||
return LuaCode("run_file_1_in(" .. tostring(compile(path)) .. ", _ENV)")
|
return LuaCode("run_file_1_in(" .. tostring(compile(path)) .. ", _ENV, OPTIMIZATION)")
|
||||||
end,
|
end,
|
||||||
["tests"] = function(compile)
|
["tests"] = function(compile)
|
||||||
return LuaCode("TESTS")
|
return LuaCode("TESTS")
|
||||||
|
@ -98,7 +98,7 @@ compile = setmetatable({
|
|||||||
--if path.type == 'Text' and #path == 1 and type(path[1]) == 'string'
|
--if path.type == 'Text' and #path == 1 and type(path[1]) == 'string'
|
||||||
-- unless import_to_1_from(compile, path[1])
|
-- unless import_to_1_from(compile, path[1])
|
||||||
-- compile_error tree, "Could not find anything to import for #{path}"
|
-- compile_error tree, "Could not find anything to import for #{path}"
|
||||||
return LuaCode("run_file_1_in(#{compile(path)}, _ENV)")
|
return LuaCode("run_file_1_in(#{compile(path)}, _ENV, OPTIMIZATION)")
|
||||||
|
|
||||||
["tests"]: (compile)-> LuaCode("TESTS")
|
["tests"]: (compile)-> LuaCode("TESTS")
|
||||||
["test"]: (compile, body)->
|
["test"]: (compile, body)->
|
||||||
|
@ -274,8 +274,8 @@ local nomsu_environment = Importer({
|
|||||||
end,
|
end,
|
||||||
FILE_CACHE = { },
|
FILE_CACHE = { },
|
||||||
run_file_1_in = function(path, environment, optimization)
|
run_file_1_in = function(path, environment, optimization)
|
||||||
if optimization == nil then
|
if not optimization then
|
||||||
optimization = 1
|
optimization = environment.OPTIMIZATION
|
||||||
end
|
end
|
||||||
if environment.FILE_CACHE[path] then
|
if environment.FILE_CACHE[path] then
|
||||||
import_to_1_from(environment, environment.FILE_CACHE[path])
|
import_to_1_from(environment, environment.FILE_CACHE[path])
|
||||||
@ -285,7 +285,6 @@ local nomsu_environment = Importer({
|
|||||||
local i = _currently_running_files:index_of(path)
|
local i = _currently_running_files:index_of(path)
|
||||||
_currently_running_files:add(path)
|
_currently_running_files:add(path)
|
||||||
local circle = _currently_running_files:from_1_to(i, -1)
|
local circle = _currently_running_files:from_1_to(i, -1)
|
||||||
print(_currently_running_files, path)
|
|
||||||
error("Circular import detected:\n " .. circle:joined_with("\n..imports "))
|
error("Circular import detected:\n " .. circle:joined_with("\n..imports "))
|
||||||
end
|
end
|
||||||
_currently_running_files:add(path)
|
_currently_running_files:add(path)
|
||||||
|
@ -150,7 +150,9 @@ nomsu_environment = Importer{
|
|||||||
error("Attempt to run unknown thing: "..tostring(to_run))
|
error("Attempt to run unknown thing: "..tostring(to_run))
|
||||||
|
|
||||||
FILE_CACHE: {}
|
FILE_CACHE: {}
|
||||||
run_file_1_in: (path, environment, optimization=1)->
|
run_file_1_in: (path, environment, optimization)->
|
||||||
|
if not optimization
|
||||||
|
optimization = environment.OPTIMIZATION
|
||||||
if environment.FILE_CACHE[path]
|
if environment.FILE_CACHE[path]
|
||||||
import_to_1_from(environment, environment.FILE_CACHE[path])
|
import_to_1_from(environment, environment.FILE_CACHE[path])
|
||||||
return
|
return
|
||||||
@ -158,7 +160,6 @@ nomsu_environment = Importer{
|
|||||||
i = _currently_running_files\index_of(path)
|
i = _currently_running_files\index_of(path)
|
||||||
_currently_running_files\add path
|
_currently_running_files\add path
|
||||||
circle = _currently_running_files\from_1_to(i, -1)
|
circle = _currently_running_files\from_1_to(i, -1)
|
||||||
print(_currently_running_files, path)
|
|
||||||
error("Circular import detected:\n "..circle\joined_with("\n..imports "))
|
error("Circular import detected:\n "..circle\joined_with("\n..imports "))
|
||||||
_currently_running_files\add path
|
_currently_running_files\add path
|
||||||
mod = _1_forked(environment)
|
mod = _1_forked(environment)
|
||||||
|
Loading…
Reference in New Issue
Block a user