mirror of
https://github.com/leafo/moonscript.git
synced 2024-11-22 02:44:23 +00:00
update error rewriters for new @ prefix on chunk name for files
This commit is contained in:
parent
f92e046d13
commit
01555dc4f4
@ -78,8 +78,8 @@ rewrite_traceback = function(text, err)
|
||||
local cache = { }
|
||||
local rewrite_single
|
||||
rewrite_single = function(trace)
|
||||
local fname, line, msg = trace:match('^%[string "(.-)"]:(%d+): (.*)$')
|
||||
local tbl = line_tables[fname]
|
||||
local fname, line, msg = trace:match('^(.-):(%d+): (.*)$')
|
||||
local tbl = line_tables["@" .. tostring(fname)]
|
||||
if fname and tbl then
|
||||
return concat({
|
||||
fname,
|
||||
|
@ -56,8 +56,8 @@ rewrite_traceback = (text, err) ->
|
||||
|
||||
cache = {} -- loaded file cache
|
||||
rewrite_single = (trace) ->
|
||||
fname, line, msg = trace\match '^%[string "(.-)"]:(%d+): (.*)$'
|
||||
tbl = line_tables[fname]
|
||||
fname, line, msg = trace\match '^(.-):(%d+): (.*)$'
|
||||
tbl = line_tables["@#{fname}"]
|
||||
if fname and tbl
|
||||
concat {
|
||||
fname, ":"
|
||||
|
@ -12,12 +12,11 @@ get_rewritten_line_no = (fname) ->
|
||||
success, err = pcall chunk
|
||||
error "`#{fname}` is supposed to have runtime error!" if success
|
||||
|
||||
source = tonumber err\match "]:(%d+)"
|
||||
source = tonumber err\match "^.-:(%d+):"
|
||||
|
||||
line_table = require("moonscript.line_tables")[fname]
|
||||
line_table = assert require("moonscript.line_tables")["@#{fname}"], "missing line table"
|
||||
errors.reverse_line_number fname, line_table, source, {}
|
||||
|
||||
|
||||
-- TODO: check entire stack trace
|
||||
describe "error rewriting", ->
|
||||
tests = {
|
||||
|
Loading…
Reference in New Issue
Block a user