diff options
| author | Marijn Haverbeke <marijnh@gmail.com> | 2011-11-30 13:38:38 +0100 |
|---|---|---|
| committer | Marijn Haverbeke <marijnh@gmail.com> | 2011-11-30 13:38:38 +0100 |
| commit | b40c6773c2f1a5a34990004cbe9b29a7575e2f7e (patch) | |
| tree | e806179dd1c8f102bbc44d7268e3e855f7b97333 /src/comp/syntax/ext | |
| parent | 586a685eecd7786679e93cf0040a0558f47877da (diff) | |
Box ast::path values
It seems inefficient to copy them around. Let's measure whether that's actually > the case
Diffstat (limited to 'src/comp/syntax/ext')
| -rw-r--r-- | src/comp/syntax/ext/concat_idents.rs | 6 | ||||
| -rw-r--r-- | src/comp/syntax/ext/fmt.rs | 2 | ||||
| -rw-r--r-- | src/comp/syntax/ext/simplext.rs | 14 |
3 files changed, 11 insertions, 11 deletions
diff --git a/src/comp/syntax/ext/concat_idents.rs b/src/comp/syntax/ext/concat_idents.rs index b2f019f233d..711a180c9a0 100644 --- a/src/comp/syntax/ext/concat_idents.rs +++ b/src/comp/syntax/ext/concat_idents.rs @@ -17,8 +17,8 @@ fn expand_syntax_ext(cx: ext_ctxt, sp: codemap::span, arg: @ast::expr, } ret @{id: cx.next_id(), - node: - ast::expr_path({node: {global: false, idents: [res], types: []}, - span: sp}), + node: ast::expr_path(@{node: {global: false, idents: [res], + types: []}, + span: sp}), span: sp}; } diff --git a/src/comp/syntax/ext/fmt.rs b/src/comp/syntax/ext/fmt.rs index 0aabf648a08..1aac14c9668 100644 --- a/src/comp/syntax/ext/fmt.rs +++ b/src/comp/syntax/ext/fmt.rs @@ -67,7 +67,7 @@ fn pieces_to_expr(cx: ext_ctxt, sp: span, pieces: [piece], args: [@ast::expr]) fn make_path_expr(cx: ext_ctxt, sp: span, idents: [ast::ident]) -> @ast::expr { let path = {global: false, idents: idents, types: []}; - let sp_path = {node: path, span: sp}; + let sp_path = @{node: path, span: sp}; let pathexpr = ast::expr_path(sp_path); ret @{id: cx.next_id(), node: pathexpr, span: sp}; } diff --git a/src/comp/syntax/ext/simplext.rs b/src/comp/syntax/ext/simplext.rs index dd66c1bef92..96d214584e7 100644 --- a/src/comp/syntax/ext/simplext.rs +++ b/src/comp/syntax/ext/simplext.rs @@ -14,7 +14,7 @@ import ast::{ident, path, ty, blk_, expr, path_, expr_path, export add_new_extension; -fn path_to_ident(pth: path) -> option::t<ident> { +fn path_to_ident(pth: @path) -> option::t<ident> { if vec::len(pth.node.idents) == 1u && vec::len(pth.node.types) == 0u { ret some(pth.node.idents[0u]); } @@ -30,7 +30,7 @@ tag arb_depth<T> { leaf(T); seq(@[arb_depth<T>], span); } tag matchable { match_expr(@expr); - match_path(path); + match_path(@path); match_ident(ast::spanned<ident>); match_ty(@ty); match_block(ast::blk); @@ -360,10 +360,10 @@ fn transcribe_expr(cx: ext_ctxt, b: bindings, idx_path: @mutable [uint], } alt follow_for_trans(cx, b.find(p.node.idents[0]), idx_path) { some(match_ident(id)) { - expr_path(respan(id.span, - {global: false, - idents: [id.node], - types: []})) + expr_path(@respan(id.span, + {global: false, + idents: [id.node], + types: []})) } some(match_path(a_pth)) { expr_path(a_pth) } some(match_expr(a_exp)) { a_exp.node } @@ -502,7 +502,7 @@ fn specialize_match(m: matchable) -> matchable { } /* pattern_to_selectors helper functions */ -fn p_t_s_r_path(cx: ext_ctxt, p: path, s: selector, b: binders) { +fn p_t_s_r_path(cx: ext_ctxt, p: @path, s: selector, b: binders) { alt path_to_ident(p) { some(p_id) { fn select(cx: ext_ctxt, m: matchable) -> match_result { |
