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

Side by Side Diff: runtime/vm/parser.cc

Issue 12211045: Allow ambiguous Expect and ExpectException imports. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Added TODO. Created 7 years, 10 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 8205 matching lines...) Expand 10 before | Expand all | Expand 10 after
8216 // imported libraries. 8216 // imported libraries.
8217 String& first_lib_url = String::Handle(); 8217 String& first_lib_url = String::Handle();
8218 Namespace& import = Namespace::Handle(); 8218 Namespace& import = Namespace::Handle();
8219 intptr_t num_imports = library_.num_imports(); 8219 intptr_t num_imports = library_.num_imports();
8220 Object& imported_obj = Object::Handle(); 8220 Object& imported_obj = Object::Handle();
8221 for (int i = 0; i < num_imports; i++) { 8221 for (int i = 0; i < num_imports; i++) {
8222 import = library_.ImportAt(i); 8222 import = library_.ImportAt(i);
8223 imported_obj = LookupNameInImport(import, name); 8223 imported_obj = LookupNameInImport(import, name);
8224 if (!imported_obj.IsNull()) { 8224 if (!imported_obj.IsNull()) {
8225 const Library& lib = Library::Handle(import.library()); 8225 const Library& lib = Library::Handle(import.library());
8226 if (!first_lib_url.IsNull()) { 8226 // TODO(8474): Remove the "Expect" special casing.
8227 if (!first_lib_url.IsNull()
8228 && (strcmp(name.ToCString(), "Expect") != 0)
8229 && (strcmp(name.ToCString(), "ExpectException") != 0)) {
8227 // Found duplicate definition. 8230 // Found duplicate definition.
8228 Error& ambiguous_ref_error = Error::Handle(); 8231 Error& ambiguous_ref_error = Error::Handle();
8229 if (first_lib_url.raw() == lib.url()) { 8232 if (first_lib_url.raw() == lib.url()) {
8230 ambiguous_ref_error = FormatErrorMsg( 8233 ambiguous_ref_error = FormatErrorMsg(
8231 script_, ident_pos, "Error", 8234 script_, ident_pos, "Error",
8232 "ambiguous reference: " 8235 "ambiguous reference: "
8233 "'%s' as library '%s' is imported multiple times", 8236 "'%s' as library '%s' is imported multiple times",
8234 name.ToCString(), 8237 name.ToCString(),
8235 first_lib_url.ToCString()); 8238 first_lib_url.ToCString());
8236 } else { 8239 } else {
(...skipping 1544 matching lines...) Expand 10 before | Expand all | Expand 10 after
9781 void Parser::SkipQualIdent() { 9784 void Parser::SkipQualIdent() {
9782 ASSERT(IsIdentifier()); 9785 ASSERT(IsIdentifier());
9783 ConsumeToken(); 9786 ConsumeToken();
9784 if (CurrentToken() == Token::kPERIOD) { 9787 if (CurrentToken() == Token::kPERIOD) {
9785 ConsumeToken(); // Consume the kPERIOD token. 9788 ConsumeToken(); // Consume the kPERIOD token.
9786 ExpectIdentifier("identifier expected after '.'"); 9789 ExpectIdentifier("identifier expected after '.'");
9787 } 9790 }
9788 } 9791 }
9789 9792
9790 } // namespace dart 9793 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698