Index: runtime/vm/parser.cc |
diff --git a/runtime/vm/parser.cc b/runtime/vm/parser.cc |
index 676b0c04f06721da19e13782981a144fdb7be855..78377451912142f5036e953695494510bc69160c 100644 |
--- a/runtime/vm/parser.cc |
+++ b/runtime/vm/parser.cc |
@@ -3329,11 +3329,15 @@ void Parser::ParseLibraryImport() { |
// Lookup the library URL. |
Library& library = Library::Handle(Library::LookupLibrary(canon_url)); |
if (library.IsNull()) { |
- // Create a new library object and call the library tag handler. |
- library = Library::New(canon_url); |
- library.Register(); |
Mads Ager (google)
2012/01/23 11:35:38
I changed the handling of this. Registering an emp
|
- // The tag handler expects the importing library as a parameter. |
+ // Call the library tag handler to load the library. |
CallLibraryTagHandler(kImportTag, import_pos, canon_url); |
+ // If the library tag handler succeded without registering the |
+ // library we create an empty library to import. |
+ library = Library::LookupLibrary(canon_url); |
+ if (library.IsNull()) { |
+ library = Library::New(canon_url); |
+ library.Register(); |
+ } |
} |
// Add the import to the library. |
if (prefix.IsNull() || (prefix.Length() == 0)) { |