diff options
| author | Erick Tryzelaar <erick.tryzelaar@gmail.com> | 2013-01-13 10:48:09 -0800 |
|---|---|---|
| committer | Erick Tryzelaar <erick.tryzelaar@gmail.com> | 2013-01-14 18:14:16 -0800 |
| commit | bea67bde21d36df40c55b02cd8d8b28c0ec864b6 (patch) | |
| tree | 4970407fc9c5b4662e315e9fe66281cfa6a93c44 /src/libsyntax/ext | |
| parent | 1be4bfb8ccfd6a91fe63cc2808f3c5e9177d52dd (diff) | |
| download | rust-bea67bde21d36df40c55b02cd8d8b28c0ec864b6.tar.gz rust-bea67bde21d36df40c55b02cd8d8b28c0ec864b6.zip | |
Change ast::path into a struct.
Diffstat (limited to 'src/libsyntax/ext')
| -rw-r--r-- | src/libsyntax/ext/auto_encode.rs | 36 | ||||
| -rw-r--r-- | src/libsyntax/ext/build.rs | 21 | ||||
| -rw-r--r-- | src/libsyntax/ext/concat_idents.rs | 8 | ||||
| -rw-r--r-- | src/libsyntax/ext/deriving.rs | 3 | ||||
| -rw-r--r-- | src/libsyntax/ext/pipes/ast_builder.rs | 28 |
5 files changed, 65 insertions, 31 deletions
diff --git a/src/libsyntax/ext/auto_encode.rs b/src/libsyntax/ext/auto_encode.rs index 4afd2e1f7f8..bc28e836802 100644 --- a/src/libsyntax/ext/auto_encode.rs +++ b/src/libsyntax/ext/auto_encode.rs @@ -264,21 +264,45 @@ priv impl ext_ctxt { } fn path(span: span, strs: ~[ast::ident]) -> @ast::path { - @{span: span, global: false, idents: strs, rp: None, types: ~[]} + @ast::path { + span: span, + global: false, + idents: strs, + rp: None, + types: ~[] + } } fn path_global(span: span, strs: ~[ast::ident]) -> @ast::path { - @{span: span, global: true, idents: strs, rp: None, types: ~[]} + @ast::path { + span: span, + global: true, + idents: strs, + rp: None, + types: ~[] + } } fn path_tps(span: span, strs: ~[ast::ident], tps: ~[@ast::Ty]) -> @ast::path { - @{span: span, global: false, idents: strs, rp: None, types: tps} + @ast::path { + span: span, + global: false, + idents: strs, + rp: None, + types: tps + } } fn path_tps_global(span: span, strs: ~[ast::ident], tps: ~[@ast::Ty]) -> @ast::path { - @{span: span, global: true, idents: strs, rp: None, types: tps} + @ast::path { + span: span, + global: true, + idents: strs, + rp: None, + types: tps + } } fn ty_path(span: span, strs: ~[ast::ident], @@ -289,11 +313,9 @@ priv impl ext_ctxt { } fn binder_pat(span: span, nm: ast::ident) -> @ast::pat { - let path = @{span: span, global: false, idents: ~[nm], - rp: None, types: ~[]}; @{id: self.next_id(), node: ast::pat_ident(ast::bind_by_ref(ast::m_imm), - path, + self.path(span, ~[nm]), None), span: span} } diff --git a/src/libsyntax/ext/build.rs b/src/libsyntax/ext/build.rs index 288ef1b273e..a50952f75e7 100644 --- a/src/libsyntax/ext/build.rs +++ b/src/libsyntax/ext/build.rs @@ -53,20 +53,29 @@ fn mk_unary(cx: ext_ctxt, sp: span, op: ast::unop, e: @ast::expr) mk_expr(cx, sp, ast::expr_unary(op, e)) } fn mk_raw_path(sp: span, idents: ~[ast::ident]) -> @ast::path { - let p : @ast::path = @{span: sp, global: false, idents: idents, - rp: None, types: ~[]}; + let p = @ast::path { span: sp, + global: false, + idents: idents, + rp: None, + types: ~[] }; return p; } fn mk_raw_path_(sp: span, idents: ~[ast::ident], +types: ~[@ast::Ty]) -> @ast::path { - @{ span: sp, global: false, idents: idents, rp: None, types: move types } + @ast::path { span: sp, + global: false, + idents: idents, + rp: None, + types: move types } } fn mk_raw_path_global(sp: span, idents: ~[ast::ident]) -> @ast::path { - let p : @ast::path = @{span: sp, global: true, idents: idents, - rp: None, types: ~[]}; - return p; + @ast::path { span: sp, + global: true, + idents: idents, + rp: None, + types: ~[] } } fn mk_path(cx: ext_ctxt, sp: span, idents: ~[ast::ident]) -> @ast::expr { diff --git a/src/libsyntax/ext/concat_idents.rs b/src/libsyntax/ext/concat_idents.rs index d847cfee053..32e77afab93 100644 --- a/src/libsyntax/ext/concat_idents.rs +++ b/src/libsyntax/ext/concat_idents.rs @@ -36,9 +36,11 @@ fn expand_syntax_ext(cx: ext_ctxt, sp: span, tts: ~[ast::token_tree]) let e = @{id: cx.next_id(), callee_id: cx.next_id(), - node: ast::expr_path(@{span: sp, global: false, - idents: ~[res], - rp: None, types: ~[]}), + node: ast::expr_path(@ast::path { span: sp, + global: false, + idents: ~[res], + rp: None, + types: ~[] }), span: sp}; mr_expr(e) } diff --git a/src/libsyntax/ext/deriving.rs b/src/libsyntax/ext/deriving.rs index afce1edf158..392b4068880 100644 --- a/src/libsyntax/ext/deriving.rs +++ b/src/libsyntax/ext/deriving.rs @@ -13,6 +13,7 @@ use core::prelude::*; +use ast; use ast::{TraitTyParamBound, Ty, and, bind_by_ref, binop, deref, enum_def}; use ast::{enum_variant_kind, expr, expr_match, ident, item, item_}; use ast::{item_enum, item_impl, item_struct, m_imm, meta_item, method}; @@ -218,7 +219,7 @@ fn create_derived_impl(cx: ext_ctxt, let impl_ty_params = dvec::unwrap(move impl_ty_params); // Create the reference to the trait. - let trait_path = { + let trait_path = ast::path { span: span, global: true, idents: trait_path.map(|x| *x), diff --git a/src/libsyntax/ext/pipes/ast_builder.rs b/src/libsyntax/ext/pipes/ast_builder.rs index 3e265de04a3..1b32ccc43d8 100644 --- a/src/libsyntax/ext/pipes/ast_builder.rs +++ b/src/libsyntax/ext/pipes/ast_builder.rs @@ -34,19 +34,19 @@ mod syntax { } fn path(ids: ~[ident], span: span) -> @ast::path { - @{span: span, - global: false, - idents: ids, - rp: None, - types: ~[]} + @ast::path { span: span, + global: false, + idents: ids, + rp: None, + types: ~[] } } fn path_global(ids: ~[ident], span: span) -> @ast::path { - @{span: span, - global: true, - idents: ids, - rp: None, - types: ~[]} + @ast::path { span: span, + global: true, + idents: ids, + rp: None, + types: ~[] } } trait append_types { @@ -56,13 +56,13 @@ trait append_types { impl @ast::path: append_types { fn add_ty(ty: @ast::Ty) -> @ast::path { - @{types: vec::append_one(self.types, ty), - .. *self} + @ast::path { types: vec::append_one(self.types, ty), + .. *self} } fn add_tys(+tys: ~[@ast::Ty]) -> @ast::path { - @{types: vec::append(self.types, tys), - .. *self} + @ast::path { types: vec::append(self.types, tys), + .. *self} } } |
