diff options
| author | Niko Matsakis <niko@alum.mit.edu> | 2012-10-08 11:49:01 -0700 |
|---|---|---|
| committer | Niko Matsakis <niko@alum.mit.edu> | 2012-10-12 19:46:37 -0700 |
| commit | 98887cc7eec0550d8364e98483ee26595b692ef8 (patch) | |
| tree | 86844a5f53496eeea7e1d05babf42fbaddf878f3 /src/libsyntax/parse | |
| parent | cb55e246ba517a14eaabb82cba3294ab4ad23c0a (diff) | |
| download | rust-98887cc7eec0550d8364e98483ee26595b692ef8.tar.gz rust-98887cc7eec0550d8364e98483ee26595b692ef8.zip | |
remove ctor from ast (take 2) (no review: just dead code removal)
Diffstat (limited to 'src/libsyntax/parse')
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 65 |
1 files changed, 9 insertions, 56 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 4457c64a68c..973822ddff9 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -115,8 +115,7 @@ enum class_member { So that we can distinguish a class ctor or dtor from other class members */ -enum class_contents { ctor_decl(fn_decl, ~[attribute], blk, codemap::span), - dtor_decl(blk, ~[attribute], codemap::span), +enum class_contents { dtor_decl(blk, ~[attribute], codemap::span), members(~[@class_member]) } type arg_or_capture_item = Either<arg, capture_item>; @@ -2683,30 +2682,13 @@ impl parser { let mut fields: ~[@struct_field]; let mut methods: ~[@method] = ~[]; - let mut the_ctor: Option<(fn_decl, ~[attribute], blk, codemap::span)> - = None; let mut the_dtor: Option<(blk, ~[attribute], codemap::span)> = None; - let ctor_id = self.get_id(); if self.eat(token::LBRACE) { // It's a record-like struct. fields = ~[]; while self.token != token::RBRACE { match self.parse_class_item() { - ctor_decl(a_fn_decl, attrs, blk, s) => { - match the_ctor { - Some((_, _, _, s_first)) => { - self.span_note(s, fmt!("Duplicate constructor \ - declaration for class %s", - *self.interner.get(class_name))); - self.span_fatal(copy s_first, ~"First constructor \ - declared here"); - } - None => { - the_ctor = Some((a_fn_decl, attrs, blk, s)); - } - } - } dtor_decl(blk, attrs, s) => { match the_dtor { Some((_, _, s_first)) => { @@ -2764,36 +2746,14 @@ impl parser { self_id: self.get_id(), body: d_body}, span: d_s}}; - match the_ctor { - Some((ct_d, ct_attrs, ct_b, ct_s)) => { - (class_name, - item_class(@{ - traits: traits, - fields: move fields, - methods: move methods, - ctor: Some({ - node: {id: ctor_id, - attrs: ct_attrs, - self_id: self.get_id(), - dec: ct_d, - body: ct_b}, - span: ct_s}), - dtor: actual_dtor - }, ty_params), - None) - } - None => { - (class_name, - item_class(@{ - traits: traits, - fields: move fields, - methods: move methods, - ctor: None, - dtor: actual_dtor - }, ty_params), - None) - } - } + (class_name, + item_class(@{ + traits: traits, + fields: move fields, + methods: move methods, + dtor: actual_dtor + }, ty_params), + None) } fn token_is_pound_or_doc_comment(++tok: token::token) -> bool { @@ -3097,12 +3057,6 @@ impl parser { let mut methods: ~[@method] = ~[]; while self.token != token::RBRACE { match self.parse_class_item() { - ctor_decl(*) => { - self.span_fatal(copy self.span, - ~"deprecated explicit \ - constructors are not allowed \ - here"); - } dtor_decl(blk, attrs, s) => { match the_dtor { Some((_, _, s_first)) => { @@ -3143,7 +3097,6 @@ impl parser { traits: ~[], fields: move fields, methods: move methods, - ctor: None, dtor: actual_dtor }; } |
