diff options
| author | Brian Anderson <banderson@mozilla.com> | 2012-11-12 15:12:20 -0800 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2012-11-12 16:21:39 -0800 |
| commit | 4c680849638b548e7202ebe4cbce2c86fd65519a (patch) | |
| tree | ec1071213df45eb85c6bb3a03d02e58238fa1ec9 /src/libsyntax/ext | |
| parent | f05e2da709cca3b20e560eaf2e05d73c0ca5d91b (diff) | |
| download | rust-4c680849638b548e7202ebe4cbce2c86fd65519a.tar.gz rust-4c680849638b548e7202ebe4cbce2c86fd65519a.zip | |
Convert most codemap types from records to structs
Diffstat (limited to 'src/libsyntax/ext')
| -rw-r--r-- | src/libsyntax/ext/base.rs | 9 | ||||
| -rw-r--r-- | src/libsyntax/ext/expand.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/ext/pipes/ast_builder.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/ext/simplext.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/ext/source_util.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/ext/tt/macro_rules.rs | 5 |
6 files changed, 14 insertions, 12 deletions
diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs index ddf58ce0fef..f588a6390d5 100644 --- a/src/libsyntax/ext/base.rs +++ b/src/libsyntax/ext/base.rs @@ -2,6 +2,7 @@ use std::map::HashMap; use parse::parser; use diagnostic::span_handler; use codemap::{CodeMap, span, expn_info, expanded_from}; +use ast_util::dummy_sp; // obsolete old-style #macro code: // @@ -169,15 +170,15 @@ fn mk_ctxt(parse_sess: parse::parse_sess, expanded_from({call_site: cs, callie: callie}) => { self.backtrace = Some(@expanded_from({ - call_site: {lo: cs.lo, hi: cs.hi, - expn_info: self.backtrace}, + call_site: span {lo: cs.lo, hi: cs.hi, + expn_info: self.backtrace}, callie: callie})); } } } fn bt_pop() { match self.backtrace { - Some(@expanded_from({call_site: {expn_info: prev, _}, _})) => { + Some(@expanded_from({call_site: span {expn_info: prev, _}, _})) => { self.backtrace = prev } _ => self.bug(~"tried to pop without a push") @@ -311,7 +312,7 @@ fn tt_args_to_original_flavor(cx: ext_ctxt, sp: span, arg: ~[ast::token_tree]) // these spans won't matter, anyways fn ms(m: matcher_) -> matcher { - {node: m, span: {lo: 0u, hi: 0u, expn_info: None}} + {node: m, span: dummy_sp()} } let arg_nm = cx.parse_sess().interner.gensym(@~"arg"); diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index 22e2cfcde6b..ca054255fa6 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -232,7 +232,7 @@ fn expand_item_mac(exts: HashMap<~str, syntax_extension>, fn new_span(cx: ext_ctxt, sp: span) -> span { /* this discards information in the case of macro-defining macros */ - return {lo: sp.lo, hi: sp.hi, expn_info: cx.backtrace()}; + return span {lo: sp.lo, hi: sp.hi, expn_info: cx.backtrace()}; } // FIXME (#2247): this is a terrible kludge to inject some macros into diff --git a/src/libsyntax/ext/pipes/ast_builder.rs b/src/libsyntax/ext/pipes/ast_builder.rs index f03adb90f0b..3d63b0ddb77 100644 --- a/src/libsyntax/ext/pipes/ast_builder.rs +++ b/src/libsyntax/ext/pipes/ast_builder.rs @@ -24,7 +24,7 @@ fn path(ids: ~[ident], span: span) -> @ast::path { } fn empty_span() -> span { - {lo: 0, hi: 0, expn_info: None} + span {lo: 0, hi: 0, expn_info: None} } trait append_types { @@ -95,7 +95,7 @@ impl ext_ctxt: ext_ctxt_ast_builder { } fn empty_span() -> span { - {lo: 0, hi: 0, expn_info: self.backtrace()} + span {lo: 0, hi: 0, expn_info: self.backtrace()} } fn block_expr(b: ast::blk) -> @ast::expr { diff --git a/src/libsyntax/ext/simplext.rs b/src/libsyntax/ext/simplext.rs index bec29c9a835..df7674264ca 100644 --- a/src/libsyntax/ext/simplext.rs +++ b/src/libsyntax/ext/simplext.rs @@ -177,7 +177,7 @@ fn transcribe(cx: ext_ctxt, b: bindings, body: @expr) -> @expr { fn new_id(_old: node_id, cx: ext_ctxt) -> node_id { return cx.next_id(); } fn new_span(cx: ext_ctxt, sp: span) -> span { /* this discards information in the case of macro-defining macros */ - return {lo: sp.lo, hi: sp.hi, expn_info: cx.backtrace()}; + return span {lo: sp.lo, hi: sp.hi, expn_info: cx.backtrace()}; } let afp = default_ast_fold(); let f_pre = diff --git a/src/libsyntax/ext/source_util.rs b/src/libsyntax/ext/source_util.rs index 9b41d90e6d0..90f08095286 100644 --- a/src/libsyntax/ext/source_util.rs +++ b/src/libsyntax/ext/source_util.rs @@ -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}; @@ -34,7 +34,7 @@ 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, _ }, _ } = + let loc { file: @filemap_ { name: filename, _ }, _ } = codemap::lookup_char_pos(cx.codemap(), sp.lo); return mk_uniq_str(cx, sp, filename); } diff --git a/src/libsyntax/ext/tt/macro_rules.rs b/src/libsyntax/ext/tt/macro_rules.rs index 31bc375a76d..8bfd1c0a18d 100644 --- a/src/libsyntax/ext/tt/macro_rules.rs +++ b/src/libsyntax/ext/tt/macro_rules.rs @@ -9,12 +9,13 @@ use macro_parser::{parse, parse_or_else, success, failure, named_match, matched_seq, matched_nonterminal, error}; use std::map::HashMap; use parse::token::special_idents; +use ast_util::dummy_sp; fn add_new_extension(cx: ext_ctxt, sp: span, name: ident, arg: ~[ast::token_tree]) -> base::mac_result { // these spans won't matter, anyways fn ms(m: matcher_) -> matcher { - {node: m, span: {lo: 0u, hi: 0u, expn_info: None}} + {node: m, span: dummy_sp()} } let lhs_nm = cx.parse_sess().interner.gensym(@~"lhs"); @@ -65,7 +66,7 @@ fn add_new_extension(cx: ext_ctxt, sp: span, name: ident, } // Which arm's failure should we report? (the one furthest along) - let mut best_fail_spot = {lo: 0u, hi: 0u, expn_info: None}; + let mut best_fail_spot = dummy_sp(); let mut best_fail_msg = ~"internal error: ran no matchers"; let s_d = cx.parse_sess().span_diagnostic; |
