Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(744)

Unified Diff: runtime/vm/parser.cc

Issue 9252001: Report error on duplicate supertypes (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/language/src/DuplicateImplementsTest.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/parser.cc
===================================================================
--- runtime/vm/parser.cc (revision 3368)
+++ runtime/vm/parser.cc (working copy)
@@ -2984,9 +2984,19 @@
ASSERT((CurrentToken() == Token::kIMPLEMENTS) ||
(CurrentToken() == Token::kEXTENDS));
GrowableArray<AbstractType*> interfaces;
+ String& interface_name = String::Handle();
do {
ConsumeToken();
+ intptr_t supertype_pos = token_index_;
AbstractType& interface = AbstractType::ZoneHandle(ParseType(kCanResolve));
+ interface_name = interface.Name();
+ for (int i = 0; i < interfaces.length(); i++) {
+ String& other_name = String::Handle(interfaces[i]->Name());
+ if (interface_name.Equals(other_name)) {
hausner 2012/01/18 01:06:16 I tried to use Equals on the type object directly,
regis 2012/01/18 01:29:40 Using the name seems brittle. How about using Abst
hausner 2012/01/18 17:44:00 As discussed in person: doing the check in the fin
+ ErrorMsg(supertype_pos, "Duplicate supertype '%s'",
+ interface_name.ToCString());
+ }
+ }
interfaces.Add(&interface);
} while (CurrentToken() == Token::kCOMMA);
return NewArray<AbstractType>(interfaces);
« no previous file with comments | « no previous file | tests/language/src/DuplicateImplementsTest.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698