diff options
| author | John Clements <clements@racket-lang.org> | 2013-03-26 17:00:35 -0700 |
|---|---|---|
| committer | John Clements <clements@racket-lang.org> | 2013-04-10 09:15:04 -0700 |
| commit | 48e7bda8269861df43763b4fb42e68af0eb09b20 (patch) | |
| tree | 3aa7179b026047f62881b1734b4c86402af41759 /src/libsyntax | |
| parent | 5d01f649b4cda55cb6ec358d0e2685c9901f62a1 (diff) | |
| download | rust-48e7bda8269861df43763b4fb42e68af0eb09b20.tar.gz rust-48e7bda8269861df43763b4fb42e68af0eb09b20.zip | |
path -> Path
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ast.rs | 24 | ||||
| -rw-r--r-- | src/libsyntax/ast_util.rs | 6 | ||||
| -rw-r--r-- | src/libsyntax/ext/auto_encode.rs | 20 | ||||
| -rw-r--r-- | src/libsyntax/ext/build.rs | 16 | ||||
| -rw-r--r-- | src/libsyntax/ext/concat_idents.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/ext/deriving/mod.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/ext/pipes/ast_builder.rs | 30 | ||||
| -rw-r--r-- | src/libsyntax/fold.rs | 10 | ||||
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 16 | ||||
| -rw-r--r-- | src/libsyntax/parse/token.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/print/pprust.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/visit.rs | 2 |
12 files changed, 67 insertions, 67 deletions
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index ec77b54a853..4add371a36f 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -113,7 +113,7 @@ pub struct Lifetime { #[auto_encode] #[auto_decode] #[deriving(Eq)] -pub struct path { +pub struct Path { span: span, global: bool, idents: ~[ident], @@ -301,10 +301,10 @@ pub enum pat_ { // which it is. The resolver determines this, and // records this pattern's node_id in an auxiliary // set (of "pat_idents that refer to nullary enums") - pat_ident(binding_mode, @path, Option<@pat>), - pat_enum(@path, Option<~[@pat]>), /* "none" means a * pattern where + pat_ident(binding_mode, @Path, Option<@pat>), + pat_enum(@Path, Option<~[@pat]>), /* "none" means a * pattern where * we don't bind the fields to names */ - pat_struct(@path, ~[field_pat], bool), + pat_struct(@Path, ~[field_pat], bool), pat_tup(~[@pat]), pat_box(@pat), pat_uniq(@pat), @@ -567,7 +567,7 @@ pub enum expr_ { expr_assign_op(binop, @expr, @expr), expr_field(@expr, ident, ~[@Ty]), expr_index(@expr, @expr), - expr_path(@path), + expr_path(@Path), expr_addr_of(mutability, @expr), expr_break(Option<ident>), expr_again(Option<ident>), @@ -579,7 +579,7 @@ pub enum expr_ { expr_mac(mac), // A struct literal expression. - expr_struct(@path, ~[field], Option<@expr>), + expr_struct(@Path, ~[field], Option<@expr>), // A vector literal constructed from one repeated element. expr_repeat(@expr /* element */, @expr /* count */, mutability), @@ -697,7 +697,7 @@ pub type mac = spanned<mac_>; #[auto_decode] #[deriving(Eq)] pub enum mac_ { - mac_invoc_tt(@path,~[token_tree]), // new macro-invocation + mac_invoc_tt(@Path,~[token_tree]), // new macro-invocation } pub type lit = spanned<lit_>; @@ -894,7 +894,7 @@ pub enum ty_ { ty_closure(@TyClosure), ty_bare_fn(@TyBareFn), ty_tup(~[@Ty]), - ty_path(@path, node_id), + ty_path(@Path, node_id), ty_mac(mac), // ty_infer means the type should be inferred instead of it having been // specified. This should only appear at the "top level" of a type and not @@ -1118,13 +1118,13 @@ pub enum view_path_ { // or just // // foo::bar::baz (with 'baz =' implicitly on the left) - view_path_simple(ident, @path, namespace, node_id), + view_path_simple(ident, @Path, namespace, node_id), // foo::bar::* - view_path_glob(@path, node_id), + view_path_glob(@Path, node_id), // foo::bar::{a,b,c} - view_path_list(@path, ~[path_list_ident], node_id) + view_path_list(@Path, ~[path_list_ident], node_id) } #[auto_encode] @@ -1177,7 +1177,7 @@ pub struct attribute_ { #[auto_decode] #[deriving(Eq)] pub struct trait_ref { - path: @path, + path: @Path, ref_id: node_id, } diff --git a/src/libsyntax/ast_util.rs b/src/libsyntax/ast_util.rs index c7227fa1768..e83a3ef8bad 100644 --- a/src/libsyntax/ast_util.rs +++ b/src/libsyntax/ast_util.rs @@ -30,7 +30,7 @@ pub fn path_name_i(idents: &[ident], intr: @token::ident_interner) -> ~str { } -pub fn path_to_ident(p: @path) -> ident { copy *p.idents.last() } +pub fn path_to_ident(p: @Path) -> ident { copy *p.idents.last() } pub fn local_def(id: node_id) -> def_id { ast::def_id { crate: local_crate, node: id } @@ -223,8 +223,8 @@ pub fn default_block( } } -pub fn ident_to_path(s: span, +i: ident) -> @path { - @ast::path { span: s, +pub fn ident_to_path(s: span, +i: ident) -> @Path { + @ast::Path { span: s, global: false, idents: ~[i], rp: None, diff --git a/src/libsyntax/ext/auto_encode.rs b/src/libsyntax/ext/auto_encode.rs index 97bc89248ac..f9dadb560e3 100644 --- a/src/libsyntax/ext/auto_encode.rs +++ b/src/libsyntax/ext/auto_encode.rs @@ -224,7 +224,7 @@ priv impl @ext_ctxt { &self, _span: span, ident: ast::ident, - path: @ast::path, + path: @ast::Path, bounds: @OptVec<ast::TyParamBound> ) -> ast::TyParam { let bound = ast::TraitTyParamBound(@ast::trait_ref { @@ -248,8 +248,8 @@ priv impl @ext_ctxt { } } - fn path(&self, span: span, +strs: ~[ast::ident]) -> @ast::path { - @ast::path { + fn path(&self, span: span, +strs: ~[ast::ident]) -> @ast::Path { + @ast::Path { span: span, global: false, idents: strs, @@ -258,8 +258,8 @@ priv impl @ext_ctxt { } } - fn path_global(&self, span: span, +strs: ~[ast::ident]) -> @ast::path { - @ast::path { + fn path_global(&self, span: span, +strs: ~[ast::ident]) -> @ast::Path { + @ast::Path { span: span, global: true, idents: strs, @@ -273,8 +273,8 @@ priv impl @ext_ctxt { span: span, +strs: ~[ast::ident], +tps: ~[@ast::Ty] - ) -> @ast::path { - @ast::path { + ) -> @ast::Path { + @ast::Path { span: span, global: false, idents: strs, @@ -288,8 +288,8 @@ priv impl @ext_ctxt { span: span, +strs: ~[ast::ident], +tps: ~[@ast::Ty] - ) -> @ast::path { - @ast::path { + ) -> @ast::Path { + @ast::Path { span: span, global: true, idents: strs, @@ -439,7 +439,7 @@ fn mk_impl( span: span, ident: ast::ident, ty_param: ast::TyParam, - path: @ast::path, + path: @ast::Path, generics: &ast::Generics, f: &fn(@ast::Ty) -> @ast::method ) -> @ast::item { diff --git a/src/libsyntax/ext/build.rs b/src/libsyntax/ext/build.rs index 43f0c9edcb9..0f84ac41532 100644 --- a/src/libsyntax/ext/build.rs +++ b/src/libsyntax/ext/build.rs @@ -63,8 +63,8 @@ pub fn mk_unary(cx: @ext_ctxt, sp: span, op: ast::unop, e: @ast::expr) cx.next_id(); // see ast_util::op_expr_callee_id mk_expr(cx, sp, ast::expr_unary(op, e)) } -pub fn mk_raw_path(sp: span, +idents: ~[ast::ident]) -> @ast::path { - let p = @ast::path { span: sp, +pub fn mk_raw_path(sp: span, +idents: ~[ast::ident]) -> @ast::Path { + let p = @ast::Path { span: sp, global: false, idents: idents, rp: None, @@ -74,15 +74,15 @@ pub fn mk_raw_path(sp: span, +idents: ~[ast::ident]) -> @ast::path { pub fn mk_raw_path_(sp: span, +idents: ~[ast::ident], +types: ~[@ast::Ty]) - -> @ast::path { - @ast::path { span: sp, + -> @ast::Path { + @ast::Path { span: sp, global: false, idents: idents, rp: None, types: types } } -pub fn mk_raw_path_global(sp: span, +idents: ~[ast::ident]) -> @ast::path { - @ast::path { span: sp, +pub fn mk_raw_path_global(sp: span, +idents: ~[ast::ident]) -> @ast::Path { + @ast::Path { span: sp, global: true, idents: idents, rp: None, @@ -295,7 +295,7 @@ pub fn mk_pat_ident_with_binding_mode(cx: @ext_ctxt, } pub fn mk_pat_enum(cx: @ext_ctxt, span: span, - path: @ast::path, + path: @ast::Path, +subpats: ~[@ast::pat]) -> @ast::pat { let pat = ast::pat_enum(path, Some(subpats)); @@ -303,7 +303,7 @@ pub fn mk_pat_enum(cx: @ext_ctxt, } pub fn mk_pat_struct(cx: @ext_ctxt, span: span, - path: @ast::path, + path: @ast::Path, +field_pats: ~[ast::field_pat]) -> @ast::pat { let pat = ast::pat_struct(path, field_pats, false); diff --git a/src/libsyntax/ext/concat_idents.rs b/src/libsyntax/ext/concat_idents.rs index 0c3bef56459..f4901191b8a 100644 --- a/src/libsyntax/ext/concat_idents.rs +++ b/src/libsyntax/ext/concat_idents.rs @@ -41,7 +41,7 @@ pub fn expand_syntax_ext(cx: @ext_ctxt, sp: span, tts: &[ast::token_tree]) id: cx.next_id(), callee_id: cx.next_id(), node: ast::expr_path( - @ast::path { + @ast::Path { span: sp, global: false, idents: ~[res], diff --git a/src/libsyntax/ext/deriving/mod.rs b/src/libsyntax/ext/deriving/mod.rs index ccd9a33757d..4337546930f 100644 --- a/src/libsyntax/ext/deriving/mod.rs +++ b/src/libsyntax/ext/deriving/mod.rs @@ -185,7 +185,7 @@ pub fn create_derived_impl(cx: @ext_ctxt, }); // Create the reference to the trait. - let trait_path = ast::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 1d1a101d61f..5eea58b89b1 100644 --- a/src/libsyntax/ext/pipes/ast_builder.rs +++ b/src/libsyntax/ext/pipes/ast_builder.rs @@ -34,16 +34,16 @@ mod syntax { pub use parse; } -pub fn path(+ids: ~[ident], span: span) -> @ast::path { - @ast::path { span: span, +pub fn path(+ids: ~[ident], span: span) -> @ast::Path { + @ast::Path { span: span, global: false, idents: ids, rp: None, types: ~[] } } -pub fn path_global(+ids: ~[ident], span: span) -> @ast::path { - @ast::path { span: span, +pub fn path_global(+ids: ~[ident], span: span) -> @ast::Path { + @ast::Path { span: span, global: true, idents: ids, rp: None, @@ -51,20 +51,20 @@ pub fn path_global(+ids: ~[ident], span: span) -> @ast::path { } pub trait append_types { - fn add_ty(&self, ty: @ast::Ty) -> @ast::path; - fn add_tys(&self, +tys: ~[@ast::Ty]) -> @ast::path; + fn add_ty(&self, ty: @ast::Ty) -> @ast::Path; + fn add_tys(&self, +tys: ~[@ast::Ty]) -> @ast::Path; } -impl append_types for @ast::path { - fn add_ty(&self, ty: @ast::Ty) -> @ast::path { - @ast::path { +impl append_types for @ast::Path { + fn add_ty(&self, ty: @ast::Ty) -> @ast::Path { + @ast::Path { types: vec::append_one(copy self.types, ty), .. copy **self } } - fn add_tys(&self, +tys: ~[@ast::Ty]) -> @ast::path { - @ast::path { + fn add_tys(&self, +tys: ~[@ast::Ty]) -> @ast::Path { + @ast::Path { types: vec::append(copy self.types, tys), .. copy **self } @@ -108,7 +108,7 @@ pub trait ext_ctxt_ast_builder { span: span, +struct_def: ast::struct_def) -> @ast::item; fn struct_expr(&self, - path: @ast::path, + path: @ast::Path, +fields: ~[ast::field]) -> @ast::expr; fn variant(&self, name: ident, @@ -118,7 +118,7 @@ pub trait ext_ctxt_ast_builder { name: ident, span: span, +items: ~[@ast::item]) -> @ast::item; - fn ty_path_ast_builder(&self, path: @ast::path) -> @ast::Ty; + fn ty_path_ast_builder(&self, path: @ast::Path) -> @ast::Ty; fn item_ty_poly(&self, name: ident, span: span, @@ -328,7 +328,7 @@ impl ext_ctxt_ast_builder for @ext_ctxt { self.item(name, span, ast::item_struct(@struct_def, generics)) } - fn struct_expr(&self, path: @ast::path, + fn struct_expr(&self, path: @ast::Path, +fields: ~[ast::field]) -> @ast::expr { @ast::expr { id: self.next_id(), @@ -397,7 +397,7 @@ impl ext_ctxt_ast_builder for @ext_ctxt { ) } - fn ty_path_ast_builder(&self, path: @ast::path) -> @ast::Ty { + fn ty_path_ast_builder(&self, path: @ast::Path) -> @ast::Ty { @ast::Ty { id: self.next_id(), node: ast::ty_path(path, self.next_id()), diff --git a/src/libsyntax/fold.rs b/src/libsyntax/fold.rs index 5aa51c262e1..768dba21412 100644 --- a/src/libsyntax/fold.rs +++ b/src/libsyntax/fold.rs @@ -36,7 +36,7 @@ pub trait ast_fold { fn fold_foreign_mod(@self, &foreign_mod) -> foreign_mod; fn fold_variant(@self, &variant) -> variant; fn fold_ident(@self, ident) -> ident; - fn fold_path(@self, @path) -> @path; + fn fold_path(@self, @Path) -> @Path; fn fold_local(@self, @local) -> @local; fn map_exprs(@self, @fn(@expr) -> @expr, &[@expr]) -> ~[@expr]; fn new_id(@self, node_id) -> node_id; @@ -65,7 +65,7 @@ pub struct AstFoldFns { fold_foreign_mod: @fn(&foreign_mod, @ast_fold) -> foreign_mod, fold_variant: @fn(&variant_, span, @ast_fold) -> (variant_, span), fold_ident: @fn(ident, @ast_fold) -> ident, - fold_path: @fn(@path, @ast_fold) -> path, + fold_path: @fn(@Path, @ast_fold) -> Path, fold_local: @fn(&local_, span, @ast_fold) -> (local_, span), map_exprs: @fn(@fn(@expr) -> @expr, &[@expr]) -> ~[@expr], new_id: @fn(node_id) -> node_id, @@ -702,8 +702,8 @@ fn noop_fold_ident(i: ident, _fld: @ast_fold) -> ident { /* FIXME (#2543) */ copy i } -fn noop_fold_path(p: @path, fld: @ast_fold) -> path { - ast::path { +fn noop_fold_path(p: @Path, fld: @ast_fold) -> Path { + ast::Path { span: fld.new_span(p.span), global: p.global, idents: p.idents.map(|x| fld.fold_ident(*x)), @@ -851,7 +851,7 @@ impl ast_fold for AstFoldFns { fn fold_ident(@self, x: ident) -> ident { (self.fold_ident)(x, self as @ast_fold) } - fn fold_path(@self, x: @path) -> @path { + fn fold_path(@self, x: @Path) -> @Path { @(self.fold_path)(x, self as @ast_fold) } fn fold_local(@self, x: @local) -> @local { diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 3a3597828cd..ca6fab62e29 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -897,7 +897,7 @@ pub impl Parser { // parse a path that doesn't have type parameters attached fn parse_path_without_tps(&self) - -> @ast::path { + -> @ast::Path { maybe_whole!(self, nt_path); let lo = self.span.lo; let global = self.eat(&token::MOD_SEP); @@ -917,7 +917,7 @@ pub impl Parser { break; } } - @ast::path { span: mk_sp(lo, self.last_span.hi), + @ast::Path { span: mk_sp(lo, self.last_span.hi), global: global, idents: ids, rp: None, @@ -927,7 +927,7 @@ pub impl Parser { // parse a path optionally with type parameters. If 'colons' // is true, then type parameters must be preceded by colons, // as in a::t::<t1,t2> - fn parse_path_with_tps(&self, colons: bool) -> @ast::path { + fn parse_path_with_tps(&self, colons: bool) -> @ast::Path { debug!("parse_path_with_tps(colons=%b)", colons); maybe_whole!(self, nt_path); @@ -982,7 +982,7 @@ pub impl Parser { } }; - @ast::path { span: mk_sp(lo, hi), + @ast::Path { span: mk_sp(lo, hi), rp: rp, types: tps, .. copy *path } @@ -4215,7 +4215,7 @@ pub impl Parser { let id = self.parse_ident(); path.push(id); } - let path = @ast::path { span: mk_sp(lo, self.span.hi), + let path = @ast::Path { span: mk_sp(lo, self.span.hi), global: false, idents: path, rp: None, @@ -4244,7 +4244,7 @@ pub impl Parser { seq_sep_trailing_allowed(token::COMMA), |p| p.parse_path_list_ident() ); - let path = @ast::path { span: mk_sp(lo, self.span.hi), + let path = @ast::Path { span: mk_sp(lo, self.span.hi), global: false, idents: path, rp: None, @@ -4256,7 +4256,7 @@ pub impl Parser { // foo::bar::* token::BINOP(token::STAR) => { self.bump(); - let path = @ast::path { span: mk_sp(lo, self.span.hi), + let path = @ast::Path { span: mk_sp(lo, self.span.hi), global: false, idents: path, rp: None, @@ -4272,7 +4272,7 @@ pub impl Parser { _ => () } let last = path[vec::len(path) - 1u]; - let path = @ast::path { span: mk_sp(lo, self.span.hi), + let path = @ast::Path { span: mk_sp(lo, self.span.hi), global: false, idents: path, rp: None, diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs index 713a6e89475..54b2ad85147 100644 --- a/src/libsyntax/parse/token.rs +++ b/src/libsyntax/parse/token.rs @@ -113,7 +113,7 @@ pub enum nonterminal { nt_expr(@ast::expr), nt_ty( @ast::Ty), nt_ident(ast::ident, bool), - nt_path(@ast::path), + nt_path(@ast::Path), nt_tt( @ast::token_tree), //needs @ed to break a circularity nt_matchers(~[ast::matcher]) } diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index 20fc99baf21..fa1b9727566 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -178,7 +178,7 @@ pub fn generics_to_str(generics: &ast::Generics, to_str(generics, print_generics, intr) } -pub fn path_to_str(&&p: @ast::path, intr: @ident_interner) -> ~str { +pub fn path_to_str(&&p: @ast::Path, intr: @ident_interner) -> ~str { to_str(p, |a,b| print_path(a, b, false), intr) } @@ -1486,7 +1486,7 @@ pub fn print_for_decl(s: @ps, loc: @ast::local, coll: @ast::expr) { print_expr(s, coll); } -pub fn print_path(s: @ps, &&path: @ast::path, colons_before_params: bool) { +pub fn print_path(s: @ps, &&path: @ast::Path, colons_before_params: bool) { maybe_print_comment(s, path.span.lo); if path.global { word(s.s, ~"::"); } let mut first = true; diff --git a/src/libsyntax/visit.rs b/src/libsyntax/visit.rs index b20c5eeee1f..c4c187bc4c7 100644 --- a/src/libsyntax/visit.rs +++ b/src/libsyntax/visit.rs @@ -265,7 +265,7 @@ pub fn visit_ty<E>(t: @Ty, e: E, v: vt<E>) { } } -pub fn visit_path<E>(p: @path, e: E, v: vt<E>) { +pub fn visit_path<E>(p: @Path, e: E, v: vt<E>) { for p.types.each |tp| { (v.visit_ty)(*tp, e, v); } } |
