aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--error_handling.lua2
-rw-r--r--error_handling.moon2
-rw-r--r--nomsu_environment.lua2
-rw-r--r--nomsu_environment.moon2
4 files changed, 4 insertions, 4 deletions
diff --git a/error_handling.lua b/error_handling.lua
index ba3389a..76b4390 100644
--- a/error_handling.lua
+++ b/error_handling.lua
@@ -103,7 +103,7 @@ print_error = function(error_message, start_fn, stop_fn)
end
local line = nil
do
- local map = SOURCE_MAP[calling_fn.source]
+ local map = SOURCE_MAP and SOURCE_MAP[calling_fn.source]
if map then
if calling_fn.currentline then
calling_fn.currentline = assert(map[calling_fn.currentline])
diff --git a/error_handling.moon b/error_handling.moon
index 97e5fe6..46580d6 100644
--- a/error_handling.moon
+++ b/error_handling.moon
@@ -66,7 +66,7 @@ print_error = (error_message, start_fn, stop_fn)->
if calling_fn.linedefined == 0 then name = "main chunk"
if name == "run_lua_fn" then continue
line = nil
- if map = SOURCE_MAP[calling_fn.source]
+ if map = SOURCE_MAP and SOURCE_MAP[calling_fn.source]
if calling_fn.currentline
calling_fn.currentline = assert(map[calling_fn.currentline])
if calling_fn.linedefined
diff --git a/nomsu_environment.lua b/nomsu_environment.lua
index 51100fc..13225c0 100644
--- a/nomsu_environment.lua
+++ b/nomsu_environment.lua
@@ -255,7 +255,7 @@ local nomsu_environment = Importer({
error("Failed to compile generated code:\n\027[1;34m" .. tostring(line_numbered_lua) .. "\027[0m\n\n" .. tostring(err), 0)
end
local source_key = tostring(source)
- if not (environment.SOURCE_MAP[source_key]) then
+ if not (environment.SOURCE_MAP[source_key] or environment.OPTIMIZATION >= 2) then
local map = { }
local file = Files.read(source.filename)
if not file then
diff --git a/nomsu_environment.moon b/nomsu_environment.moon
index a5b1169..6ae57d2 100644
--- a/nomsu_environment.moon
+++ b/nomsu_environment.moon
@@ -131,7 +131,7 @@ nomsu_environment = Importer{
line_numbered_lua = table.concat(lines, "\n")
error("Failed to compile generated code:\n\027[1;34m#{line_numbered_lua}\027[0m\n\n#{err}", 0)
source_key = tostring(source)
- unless environment.SOURCE_MAP[source_key]
+ unless environment.SOURCE_MAP[source_key] or environment.OPTIMIZATION >= 2
map = {}
file = Files.read(source.filename)
if not file