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

Side by Side Diff: vm/parser.cc

Issue 10969002: Issue a more meaningful error message when we see duplicate definitions (ambiguous reference) (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 3 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 7968 matching lines...) Expand 10 before | Expand all | Expand 10 after
7979 String& first_lib_url = String::Handle(); 7979 String& first_lib_url = String::Handle();
7980 Library& lib = Library::Handle(); 7980 Library& lib = Library::Handle();
7981 intptr_t num_imports = library_.num_imports(); 7981 intptr_t num_imports = library_.num_imports();
7982 Object& resolved_obj = Object::Handle(); 7982 Object& resolved_obj = Object::Handle();
7983 for (int i = 0; i < num_imports; i++) { 7983 for (int i = 0; i < num_imports; i++) {
7984 lib ^= library_.ImportAt(i); 7984 lib ^= library_.ImportAt(i);
7985 resolved_obj = LookupNameInLibrary(lib, name); 7985 resolved_obj = LookupNameInLibrary(lib, name);
7986 if (!resolved_obj.IsNull()) { 7986 if (!resolved_obj.IsNull()) {
7987 if (!first_lib_url.IsNull()) { 7987 if (!first_lib_url.IsNull()) {
7988 // Found duplicate definition. 7988 // Found duplicate definition.
7989 ErrorMsg(ident_pos, 7989 if (first_lib_url.raw() == lib.url()) {
7990 "ambiguous reference: " 7990 ErrorMsg(ident_pos,
7991 "'%s' is defined in library '%s' and also in '%s'", 7991 "ambiguous reference: "
7992 name.ToCString(), 7992 "'%s' as library '%s' is imported multiple times",
7993 first_lib_url.ToCString(), 7993 name.ToCString(),
7994 String::Handle(lib.url()).ToCString()); 7994 first_lib_url.ToCString());
7995 } else {
7996 ErrorMsg(ident_pos,
7997 "ambiguous reference: "
7998 "'%s' is defined in library '%s' and also in '%s'",
7999 name.ToCString(),
8000 first_lib_url.ToCString(),
8001 String::Handle(lib.url()).ToCString());
8002 }
7995 } else { 8003 } else {
7996 first_lib_url = lib.url(); 8004 first_lib_url = lib.url();
7997 obj = resolved_obj.raw(); 8005 obj = resolved_obj.raw();
7998 } 8006 }
7999 } 8007 }
8000 } 8008 }
8001 } 8009 }
8002 return obj.raw(); 8010 return obj.raw();
8003 } 8011 }
8004 8012
(...skipping 1505 matching lines...) Expand 10 before | Expand all | Expand 10 after
9510 void Parser::SkipQualIdent() { 9518 void Parser::SkipQualIdent() {
9511 ASSERT(IsIdentifier()); 9519 ASSERT(IsIdentifier());
9512 ConsumeToken(); 9520 ConsumeToken();
9513 if (CurrentToken() == Token::kPERIOD) { 9521 if (CurrentToken() == Token::kPERIOD) {
9514 ConsumeToken(); // Consume the kPERIOD token. 9522 ConsumeToken(); // Consume the kPERIOD token.
9515 ExpectIdentifier("identifier expected after '.'"); 9523 ExpectIdentifier("identifier expected after '.'");
9516 } 9524 }
9517 } 9525 }
9518 9526
9519 } // namespace dart 9527 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698