From 1af3174fe3b565371a5978381f604ea9c01e86d3 Mon Sep 17 00:00:00 2001 From: Marijn Haverbeke Date: Fri, 8 Apr 2011 18:44:20 +0200 Subject: Move to single-uint file-position representation. This makes passing them around cheaper. There is now a table (see front/codemap.rs) that is needed to transform such an uint into an actual filename/line/col location. Also cleans up the span building in the parser a bit. --- src/comp/middle/trans.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/comp/middle') diff --git a/src/comp/middle/trans.rs b/src/comp/middle/trans.rs index 09dad4bc..3c03d0fc 100644 --- a/src/comp/middle/trans.rs +++ b/src/comp/middle/trans.rs @@ -4939,8 +4939,9 @@ fn trans_check_expr(@block_ctxt cx, @ast.expr e) -> result { fn trans_fail(@block_ctxt cx, common.span sp, str fail_str) -> result { auto V_fail_str = p2i(C_cstr(cx.fcx.ccx, fail_str)); - auto V_filename = p2i(C_cstr(cx.fcx.ccx, sp.filename)); - auto V_line = sp.lo.line as int; + auto loc = cx.fcx.ccx.sess.lookup_pos(sp.lo); + auto V_filename = p2i(C_cstr(cx.fcx.ccx, loc.filename)); + auto V_line = loc.line as int; auto args = vec(V_fail_str, V_filename, C_int(V_line)); auto sub = trans_upcall(cx, "upcall_fail", args); -- cgit v1.2.3