diff options
| author | bors <bors@rust-lang.org> | 2013-12-01 05:42:06 -0800 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2013-12-01 05:42:06 -0800 |
| commit | df41115213e851b9f23dfea3d6782dea5243a5d4 (patch) | |
| tree | ea05c3021e5c6b2e5440bcea47c90f7a91b0e847 /src/libsyntax | |
| parent | 83084e9c7793d24008b88b93d698639d0e85164a (diff) | |
| parent | 47ce9819033d235715474f8ea0420a5610855f7f (diff) | |
| download | rust-df41115213e851b9f23dfea3d6782dea5243a5d4.tar.gz rust-df41115213e851b9f23dfea3d6782dea5243a5d4.zip | |
auto merge of #10750 : Blei/rust/no-at-struct-field, r=alexcrichton
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ast.rs | 6 | ||||
| -rw-r--r-- | src/libsyntax/ast_util.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/fold.rs | 12 | ||||
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 14 | ||||
| -rw-r--r-- | src/libsyntax/visit.rs | 4 |
5 files changed, 19 insertions, 19 deletions
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index aebb5303cd4..52613ba01a1 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -1105,7 +1105,7 @@ impl visibility { } } -#[deriving(Eq, Encodable, Decodable,IterBytes)] +#[deriving(Clone, Eq, Encodable, Decodable,IterBytes)] pub struct struct_field_ { kind: struct_field_kind, id: NodeId, @@ -1115,7 +1115,7 @@ pub struct struct_field_ { pub type struct_field = Spanned<struct_field_>; -#[deriving(Eq, Encodable, Decodable,IterBytes)] +#[deriving(Clone, Eq, Encodable, Decodable,IterBytes)] pub enum struct_field_kind { named_field(Ident, visibility), unnamed_field // element of a tuple-like struct @@ -1123,7 +1123,7 @@ pub enum struct_field_kind { #[deriving(Eq, Encodable, Decodable,IterBytes)] pub struct struct_def { - fields: ~[@struct_field], /* fields, not including ctor */ + fields: ~[struct_field], /* fields, not including ctor */ /* ID of the constructor. This is only used for tuple- or enum-like * structs. */ ctor_id: Option<NodeId> diff --git a/src/libsyntax/ast_util.rs b/src/libsyntax/ast_util.rs index 094ad7afea6..11a55a4adbc 100644 --- a/src/libsyntax/ast_util.rs +++ b/src/libsyntax/ast_util.rs @@ -565,7 +565,7 @@ impl<'self, O: IdVisitingOperation> Visitor<()> for IdVisitor<'self, O> { } } - fn visit_struct_field(&mut self, struct_field: @struct_field, env: ()) { + fn visit_struct_field(&mut self, struct_field: &struct_field, env: ()) { self.operation.visit_id(struct_field.node.id); visit::walk_struct_field(self, struct_field, env) } diff --git a/src/libsyntax/fold.rs b/src/libsyntax/fold.rs index 945d22a0f5a..4f5b0f69a24 100644 --- a/src/libsyntax/fold.rs +++ b/src/libsyntax/fold.rs @@ -118,10 +118,10 @@ pub trait ast_fold { noop_fold_item(i, self) } - fn fold_struct_field(&self, sf: @struct_field) -> @struct_field { + fn fold_struct_field(&self, sf: &struct_field) -> struct_field { let fold_attribute = |x| fold_attribute_(x, self); - @Spanned { + Spanned { node: ast::struct_field_ { kind: sf.node.kind, id: self.new_id(sf.node.id), @@ -312,7 +312,7 @@ pub trait ast_fold { struct_variant_kind(ref struct_def) => { kind = struct_variant_kind(@ast::struct_def { fields: struct_def.fields.iter() - .map(|f| self.fold_struct_field(*f)).collect(), + .map(|f| self.fold_struct_field(f)).collect(), ctor_id: struct_def.ctor_id.map(|c| self.new_id(c)) }) } @@ -536,7 +536,7 @@ pub fn fold_generics<T:ast_fold>(generics: &Generics, fld: &T) -> Generics { fn fold_struct_def<T:ast_fold>(struct_def: @ast::struct_def, fld: &T) -> @ast::struct_def { @ast::struct_def { - fields: struct_def.fields.map(|f| fold_struct_field(*f, fld)), + fields: struct_def.fields.map(|f| fold_struct_field(f, fld)), ctor_id: struct_def.ctor_id.map(|cid| fld.new_id(cid)), } } @@ -562,8 +562,8 @@ fn fold_trait_ref<T:ast_fold>(p: &trait_ref, fld: &T) -> trait_ref { } } -fn fold_struct_field<T:ast_fold>(f: @struct_field, fld: &T) -> @struct_field { - @Spanned { +fn fold_struct_field<T:ast_fold>(f: &struct_field, fld: &T) -> struct_field { + Spanned { node: ast::struct_field_ { kind: f.node.kind, id: fld.new_id(f.node.id), diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 5807098c91e..5bf8c60cdc8 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -3178,7 +3178,7 @@ impl Parser { // parse a structure field fn parse_name_and_ty(&self, pr: visibility, - attrs: ~[Attribute]) -> @struct_field { + attrs: ~[Attribute]) -> struct_field { let lo = self.span.lo; if !is_plain_ident(&*self.token) { self.fatal("expected ident"); @@ -3186,7 +3186,7 @@ impl Parser { let name = self.parse_ident(); self.expect(&token::COLON); let ty = self.parse_ty(false); - @spanned(lo, self.last_span.hi, ast::struct_field_ { + spanned(lo, self.last_span.hi, ast::struct_field_ { kind: named_field(name, pr), id: ast::DUMMY_NODE_ID, ty: ty, @@ -4022,7 +4022,7 @@ impl Parser { let class_name = self.parse_ident(); let generics = self.parse_generics(); - let mut fields: ~[@struct_field]; + let mut fields: ~[struct_field]; let is_tuple_like; if self.eat(&token::LBRACE) { @@ -4053,7 +4053,7 @@ impl Parser { ty: p.parse_ty(false), attrs: attrs, }; - @spanned(lo, p.span.hi, struct_field_) + spanned(lo, p.span.hi, struct_field_) }); self.expect(&token::SEMI); } else if self.eat(&token::SEMI) { @@ -4091,7 +4091,7 @@ impl Parser { pub fn parse_single_struct_field(&self, vis: visibility, attrs: ~[Attribute]) - -> @struct_field { + -> struct_field { let a_var = self.parse_name_and_ty(vis, attrs); match *self.token { token::COMMA => { @@ -4108,7 +4108,7 @@ impl Parser { } // parse an element of a struct definition - fn parse_struct_decl_field(&self) -> @struct_field { + fn parse_struct_decl_field(&self) -> struct_field { let attrs = self.parse_outer_attributes(); @@ -4470,7 +4470,7 @@ impl Parser { // parse a structure-like enum variant definition // this should probably be renamed or refactored... fn parse_struct_def(&self) -> @struct_def { - let mut fields: ~[@struct_field] = ~[]; + let mut fields: ~[struct_field] = ~[]; while *self.token != token::RBRACE { fields.push(self.parse_struct_decl_field()); } diff --git a/src/libsyntax/visit.rs b/src/libsyntax/visit.rs index e5a06c46d06..f19a99ffcee 100644 --- a/src/libsyntax/visit.rs +++ b/src/libsyntax/visit.rs @@ -92,7 +92,7 @@ pub trait Visitor<E:Clone> { fn visit_struct_def(&mut self, s:@struct_def, i:Ident, g:&Generics, n:NodeId, e:E) { walk_struct_def(self, s, i, g, n, e) } - fn visit_struct_field(&mut self, s:@struct_field, e:E) { walk_struct_field(self, s, e) } + fn visit_struct_field(&mut self, s:&struct_field, e:E) { walk_struct_field(self, s, e) } fn visit_variant(&mut self, v:&variant, g:&Generics, e:E) { walk_variant(self, v, g, e) } fn visit_opt_lifetime_ref(&mut self, _span: Span, @@ -538,7 +538,7 @@ pub fn walk_struct_def<E:Clone, V:Visitor<E>>(visitor: &mut V, _: NodeId, env: E) { for field in struct_definition.fields.iter() { - visitor.visit_struct_field(*field, env.clone()) + visitor.visit_struct_field(field, env.clone()) } } |
