about summary refs log tree commit diff
path: root/src/libsyntax/parse
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2012-08-08 15:34:17 -0700
committerBrian Anderson <banderson@mozilla.com>2012-08-08 18:19:26 -0700
commit436a90e3d78a81379e36c8acec49e170bb1cd0e6 (patch)
tree3bb193ca356b02aee650007ac17728c0553bd71b /src/libsyntax/parse
parent43c9c637d345ca75ffec7583806ebd8b0520e31b (diff)
downloadrust-436a90e3d78a81379e36c8acec49e170bb1cd0e6.tar.gz
rust-436a90e3d78a81379e36c8acec49e170bb1cd0e6.zip
syntax: Stop supporting old impl syntax
Diffstat (limited to 'src/libsyntax/parse')
-rw-r--r--src/libsyntax/parse/parser.rs71
1 files changed, 12 insertions, 59 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index a572290a6f1..5141c842335 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -2440,66 +2440,19 @@ class parser {
             tps = ~[];
         }
 
-        let mut ident;
-        let ty, traits;
-        if !self.is_keyword(~"of") &&
-                !self.token_is_keyword(~"of", self.look_ahead(1)) &&
-                !self.token_is_keyword(~"for", self.look_ahead(1)) &&
-                self.look_ahead(1) != token::BINOP(token::SLASH) &&
-                (self.look_ahead(1) != token::LT
-                 || (self.look_ahead(1) == token::LT && tps.is_not_empty())) {
-
-            // This is a new-style impl declaration.
-            ident = @~"__extensions__";     // XXX: clownshoes
-
-            // Parse the type.
-            ty = self.parse_ty(false);
-
-            // Parse traits, if necessary.
-            if self.token == token::COLON {
-                self.bump();
-                traits = self.parse_trait_ref_list(token::LBRACE);
-            } else {
-                traits = ~[];
-            }
-        } else {
-            self.warn(~"old-style named impl?");
-            let mut ident_old;
-            if self.token == token::BINOP(token::SLASH) {
-                self.parse_region_param();
-                ident_old = none;
-                tps = self.parse_ty_params();
-            } else if self.is_keyword(~"of") {
-                ident_old = none;
-            } else {
-                ident_old = some(self.parse_ident());
-                self.parse_region_param();
-                tps = self.parse_ty_params();
-            }
+        // This is a new-style impl declaration.
+        let ident = @~"__extensions__";     // XXX: clownshoes
 
-            if self.eat_keyword(~"of") {
-                let for_atom = (*self.reader.interner()).intern(@~"for");
-                traits = self.parse_trait_ref_list
-                    (token::IDENT(for_atom, false));
-                if traits.len() >= 1 && option::is_none(ident_old) {
-                    ident_old = some(vec::last(traits[0].path.idents));
-                }
-                if traits.len() == 0 {
-                    self.fatal(~"BUG: 'of' but no trait");
-                }
-                if traits.len() > 1 {
-                    self.fatal(~"BUG: multiple traits");
-                }
-            } else {
-                traits = ~[];
-            };
-            ident = match ident_old {
-              some(name) => name,
-              none => { self.expect_keyword(~"of"); fail; }
-            };
-            self.expect_keyword(~"for");
-            ty = self.parse_ty(false);
-        }
+        // Parse the type.
+        let ty = self.parse_ty(false);
+
+        // Parse traits, if necessary.
+        let traits = if self.token == token::COLON {
+            self.bump();
+            self.parse_trait_ref_list(token::LBRACE)
+        } else {
+            ~[]
+        };
 
         let mut meths = ~[];
         self.expect(token::LBRACE);