| 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 8179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8190 const Array& imports = Array::Handle(prefix.imports()); | 8190 const Array& imports = Array::Handle(prefix.imports()); |
| 8191 for (intptr_t i = 0; i < prefix.num_imports(); i++) { | 8191 for (intptr_t i = 0; i < prefix.num_imports(); i++) { |
| 8192 import ^= imports.At(i); | 8192 import ^= imports.At(i); |
| 8193 resolved_obj = LookupNameInImport(import, name); | 8193 resolved_obj = LookupNameInImport(import, name); |
| 8194 if (!resolved_obj.IsNull()) { | 8194 if (!resolved_obj.IsNull()) { |
| 8195 obj = resolved_obj.raw(); | 8195 obj = resolved_obj.raw(); |
| 8196 const Library& lib = Library::Handle(import.library()); | 8196 const Library& lib = Library::Handle(import.library()); |
| 8197 if (first_lib_url.IsNull()) { | 8197 if (first_lib_url.IsNull()) { |
| 8198 first_lib_url = lib.url(); | 8198 first_lib_url = lib.url(); |
| 8199 } else { | 8199 } else { |
| 8200 ErrorMsg(ident_pos, | 8200 // Found duplicate definition. |
| 8201 "ambiguous reference: '%s.%s' is defined in '%s' and '%s'", | 8201 if (first_lib_url.raw() == lib.url()) { |
| 8202 String::Handle(prefix.name()).ToCString(), | 8202 ErrorMsg(ident_pos, |
| 8203 name.ToCString(), | 8203 "ambiguous reference: '%s.%s' is imported multiple times", |
| 8204 first_lib_url.ToCString(), | 8204 String::Handle(prefix.name()).ToCString(), |
| 8205 String::Handle(lib.url()).ToCString()); | 8205 name.ToCString()); |
| 8206 } else { |
| 8207 ErrorMsg(ident_pos, |
| 8208 "ambiguous reference: '%s.%s' is defined in '%s' and '%s'", |
| 8209 String::Handle(prefix.name()).ToCString(), |
| 8210 name.ToCString(), |
| 8211 first_lib_url.ToCString(), |
| 8212 String::Handle(lib.url()).ToCString()); |
| 8213 } |
| 8206 } | 8214 } |
| 8207 } | 8215 } |
| 8208 } | 8216 } |
| 8209 return obj.raw(); | 8217 return obj.raw(); |
| 8210 } | 8218 } |
| 8211 | 8219 |
| 8212 | 8220 |
| 8213 RawClass* Parser::ResolveClassInPrefixScope(intptr_t ident_pos, | 8221 RawClass* Parser::ResolveClassInPrefixScope(intptr_t ident_pos, |
| 8214 const LibraryPrefix& prefix, | 8222 const LibraryPrefix& prefix, |
| 8215 const String& name) { | 8223 const String& name) { |
| (...skipping 1436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9652 void Parser::SkipQualIdent() { | 9660 void Parser::SkipQualIdent() { |
| 9653 ASSERT(IsIdentifier()); | 9661 ASSERT(IsIdentifier()); |
| 9654 ConsumeToken(); | 9662 ConsumeToken(); |
| 9655 if (CurrentToken() == Token::kPERIOD) { | 9663 if (CurrentToken() == Token::kPERIOD) { |
| 9656 ConsumeToken(); // Consume the kPERIOD token. | 9664 ConsumeToken(); // Consume the kPERIOD token. |
| 9657 ExpectIdentifier("identifier expected after '.'"); | 9665 ExpectIdentifier("identifier expected after '.'"); |
| 9658 } | 9666 } |
| 9659 } | 9667 } |
| 9660 | 9668 |
| 9661 } // namespace dart | 9669 } // namespace dart |
| OLD | NEW |