From 2ec09c4eb91b94bd68c95eaa8966d4801c3347bf Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Mon, 12 Nov 2012 18:24:56 -0800 Subject: Objectify the codemap --- src/libsyntax/ext/qquote.rs | 6 +++--- src/libsyntax/ext/source_util.rs | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'src/libsyntax/ext') diff --git a/src/libsyntax/ext/qquote.rs b/src/libsyntax/ext/qquote.rs index af7ffaa73f5..6ae083779cd 100644 --- a/src/libsyntax/ext/qquote.rs +++ b/src/libsyntax/ext/qquote.rs @@ -204,13 +204,13 @@ fn finish -> @ast::expr { let cm = ecx.codemap(); - let str = @codemap::span_to_snippet(body.span, cm); + let str = @cm.span_to_snippet(body.span); debug!("qquote--str==%?", str); - let fname = codemap::mk_substr_filename(cm, body.span); + let fname = cm.mk_substr_filename(body.span); let node = parse_from_source_str (f, fname, codemap::fss_internal(body.span), str, ecx.cfg(), ecx.parse_sess()); - let loc = codemap::lookup_char_pos(cm, body.span.lo); + let loc = cm.lookup_char_pos(body.span.lo); let sp = node.span(); let qcx = gather_anti_quotes(sp.lo, node); diff --git a/src/libsyntax/ext/source_util.rs b/src/libsyntax/ext/source_util.rs index 3181a604400..8c5048b4c6f 100644 --- a/src/libsyntax/ext/source_util.rs +++ b/src/libsyntax/ext/source_util.rs @@ -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,7 +24,7 @@ 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); + let loc = cx.codemap().lookup_char_pos(sp.lo); return mk_uint(cx, sp, loc.col); } @@ -35,7 +35,7 @@ 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 loc { file: @filemap { name: filename, _ }, _ } = - codemap::lookup_char_pos(cx.codemap(), sp.lo); + 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 -- cgit 1.4.1-3-g733a5