| Index: runtime/vm/parser.cc
|
| diff --git a/runtime/vm/parser.cc b/runtime/vm/parser.cc
|
| index fd4456805c347d005e4f3deae981a7dfa92b5a14..ff809442f3d96253d1a2377e565349dd6e756651 100644
|
| --- a/runtime/vm/parser.cc
|
| +++ b/runtime/vm/parser.cc
|
| @@ -7702,6 +7702,7 @@ RawObject* Parser::ResolveNameInCurrentLibraryScope(intptr_t ident_pos,
|
| // Name is not found in current library. Check scope of all
|
| // imported libraries.
|
| String& first_lib_url = String::Handle();
|
| + String& current_lib_url = String::Handle();
|
| Library& lib = Library::Handle();
|
| intptr_t num_imports = library_.num_imports();
|
| Object& resolved_obj = Object::Handle();
|
| @@ -7709,7 +7710,11 @@ RawObject* Parser::ResolveNameInCurrentLibraryScope(intptr_t ident_pos,
|
| lib ^= library_.ImportAt(i);
|
| resolved_obj = LookupNameInLibrary(lib, name);
|
| if (!resolved_obj.IsNull()) {
|
| - if (!first_lib_url.IsNull()) {
|
| + current_lib_url = lib.url();
|
| + if (first_lib_url.IsNull()) {
|
| + first_lib_url = lib.url();
|
| + obj = resolved_obj.raw();
|
| + } else if (!first_lib_url.Equals(current_lib_url)) {
|
| // Found duplicate definition.
|
| ErrorMsg(ident_pos,
|
| "ambiguous reference: "
|
| @@ -7717,9 +7722,6 @@ RawObject* Parser::ResolveNameInCurrentLibraryScope(intptr_t ident_pos,
|
| name.ToCString(),
|
| first_lib_url.ToCString(),
|
| String::Handle(lib.url()).ToCString());
|
| - } else {
|
| - first_lib_url = lib.url();
|
| - obj = resolved_obj.raw();
|
| }
|
| }
|
| }
|
|
|