Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/parser.h" | 5 #include "vm/parser.h" |
| 6 | 6 |
| 7 #include "vm/bigint_operations.h" | 7 #include "vm/bigint_operations.h" |
| 8 #include "vm/class_finalizer.h" | 8 #include "vm/class_finalizer.h" |
| 9 #include "vm/compiler.h" | 9 #include "vm/compiler.h" |
| 10 #include "vm/compiler_stats.h" | 10 #include "vm/compiler_stats.h" |
| (...skipping 2966 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2977 } | 2977 } |
| 2978 return TypeArguments::null(); | 2978 return TypeArguments::null(); |
| 2979 } | 2979 } |
| 2980 | 2980 |
| 2981 | 2981 |
| 2982 // Parse and return an array of interface types. | 2982 // Parse and return an array of interface types. |
| 2983 RawArray* Parser::ParseInterfaceList() { | 2983 RawArray* Parser::ParseInterfaceList() { |
| 2984 ASSERT((CurrentToken() == Token::kIMPLEMENTS) || | 2984 ASSERT((CurrentToken() == Token::kIMPLEMENTS) || |
| 2985 (CurrentToken() == Token::kEXTENDS)); | 2985 (CurrentToken() == Token::kEXTENDS)); |
| 2986 GrowableArray<AbstractType*> interfaces; | 2986 GrowableArray<AbstractType*> interfaces; |
| 2987 String& interface_name = String::Handle(); | |
| 2987 do { | 2988 do { |
| 2988 ConsumeToken(); | 2989 ConsumeToken(); |
| 2990 intptr_t supertype_pos = token_index_; | |
| 2989 AbstractType& interface = AbstractType::ZoneHandle(ParseType(kCanResolve)); | 2991 AbstractType& interface = AbstractType::ZoneHandle(ParseType(kCanResolve)); |
| 2992 interface_name = interface.Name(); | |
| 2993 for (int i = 0; i < interfaces.length(); i++) { | |
| 2994 String& other_name = String::Handle(interfaces[i]->Name()); | |
| 2995 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
| |
| 2996 ErrorMsg(supertype_pos, "Duplicate supertype '%s'", | |
| 2997 interface_name.ToCString()); | |
| 2998 } | |
| 2999 } | |
| 2990 interfaces.Add(&interface); | 3000 interfaces.Add(&interface); |
| 2991 } while (CurrentToken() == Token::kCOMMA); | 3001 } while (CurrentToken() == Token::kCOMMA); |
| 2992 return NewArray<AbstractType>(interfaces); | 3002 return NewArray<AbstractType>(interfaces); |
| 2993 } | 3003 } |
| 2994 | 3004 |
| 2995 | 3005 |
| 2996 void Parser::AddInterfaces(intptr_t interfaces_pos, | 3006 void Parser::AddInterfaces(intptr_t interfaces_pos, |
| 2997 const Class& cls, | 3007 const Class& cls, |
| 2998 const Array& interfaces) { | 3008 const Array& interfaces) { |
| 2999 GrowableArray<AbstractType*> all_interfaces; | 3009 GrowableArray<AbstractType*> all_interfaces; |
| (...skipping 4743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7743 } | 7753 } |
| 7744 | 7754 |
| 7745 | 7755 |
| 7746 void Parser::SkipNestedExpr() { | 7756 void Parser::SkipNestedExpr() { |
| 7747 const bool saved_mode = SetAllowFunctionLiterals(true); | 7757 const bool saved_mode = SetAllowFunctionLiterals(true); |
| 7748 SkipExpr(); | 7758 SkipExpr(); |
| 7749 SetAllowFunctionLiterals(saved_mode); | 7759 SetAllowFunctionLiterals(saved_mode); |
| 7750 } | 7760 } |
| 7751 | 7761 |
| 7752 } // namespace dart | 7762 } // namespace dart |
| OLD | NEW |