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};
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);
}
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 */
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);
}
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