update error rewriters for new @ prefix on chunk name for files

This commit is contained in:
leaf corcoran 2014-06-07 11:09:50 -07:00
parent f92e046d13
commit 01555dc4f4
3 changed files with 6 additions and 7 deletions

View File

@ -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,

View File

@ -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, ":"

View File

@ -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 = {