Merge remote-tracking branch 'brson/codemap'
Conflicts: src/libsyntax/ext/source_util.rs
This commit is contained in:
commit
1a1e99c27d
41 changed files with 717 additions and 525 deletions
|
@ -1,5 +1,5 @@
|
|||
use base::*;
|
||||
use codemap::span;
|
||||
use codemap::{span, Loc, FileMap};
|
||||
use print::pprust;
|
||||
use build::{mk_base_vec_e,mk_uint,mk_u8,mk_uniq_str};
|
||||
|
||||
|
@ -16,7 +16,7 @@ export expand_include_bin;
|
|||
fn expand_line(cx: ext_ctxt, sp: span, arg: ast::mac_arg,
|
||||
_body: ast::mac_body) -> @ast::expr {
|
||||
get_mac_args(cx, sp, arg, 0u, option::Some(0u), ~"line");
|
||||
let loc = codemap::lookup_char_pos(cx.codemap(), sp.lo);
|
||||
let loc = cx.codemap().lookup_char_pos(sp.lo);
|
||||
return mk_uint(cx, sp, loc.line);
|
||||
}
|
||||
|
||||
|
@ -24,8 +24,8 @@ fn expand_line(cx: ext_ctxt, sp: span, arg: ast::mac_arg,
|
|||
fn expand_col(cx: ext_ctxt, sp: span, arg: ast::mac_arg,
|
||||
_body: ast::mac_body) -> @ast::expr {
|
||||
get_mac_args(cx, sp, arg, 0u, option::Some(0u), ~"col");
|
||||
let loc = codemap::lookup_char_pos(cx.codemap(), sp.lo);
|
||||
return mk_uint(cx, sp, loc.col);
|
||||
let loc = cx.codemap().lookup_char_pos(sp.lo);
|
||||
return mk_uint(cx, sp, loc.col.to_uint());
|
||||
}
|
||||
|
||||
/* file!(): expands to the current filename */
|
||||
|
@ -34,8 +34,8 @@ fn expand_col(cx: ext_ctxt, sp: span, arg: ast::mac_arg,
|
|||
fn expand_file(cx: ext_ctxt, sp: span, arg: ast::mac_arg,
|
||||
_body: ast::mac_body) -> @ast::expr {
|
||||
get_mac_args(cx, sp, arg, 0u, option::Some(0u), ~"file");
|
||||
let { file: @{ name: filename, _ }, _ } =
|
||||
codemap::lookup_char_pos(cx.codemap(), sp.lo);
|
||||
let Loc { file: @FileMap { name: filename, _ }, _ } =
|
||||
cx.codemap().lookup_char_pos(sp.lo);
|
||||
return mk_uniq_str(cx, sp, filename);
|
||||
}
|
||||
|
||||
|
@ -103,7 +103,7 @@ fn expand_include_bin(cx: ext_ctxt, sp: codemap::span, arg: ast::mac_arg,
|
|||
fn res_rel_file(cx: ext_ctxt, sp: codemap::span, arg: &Path) -> Path {
|
||||
// NB: relative paths are resolved relative to the compilation unit
|
||||
if !arg.is_absolute {
|
||||
let cu = Path(codemap::span_to_filename(sp, cx.codemap()));
|
||||
let cu = Path(cx.codemap().span_to_filename(sp));
|
||||
cu.dir_path().push_many(arg.components)
|
||||
} else {
|
||||
copy *arg
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue