Index: runtime/bin/main.cc |
diff --git a/runtime/bin/main.cc b/runtime/bin/main.cc |
index be408da173628d16664f23c45b14a8ebb812e258..4812fa36e20a5b4c655ffdd783e9e785b7af0c19 100644 |
--- a/runtime/bin/main.cc |
+++ b/runtime/bin/main.cc |
@@ -243,7 +243,7 @@ static Dart_Handle LibraryTagHandler(Dart_LibraryTag tag, |
} |
result = DartUtils::LoadSource(NULL, library, url, tag, url_string); |
if (!Dart_IsError(result) && (tag == kImportTag)) { |
- Builtin::ImportLibrary(result); |
+ Builtin::ImportLibrary(result, Builtin::kBuiltinLibrary); |
} |
return result; |
} |
@@ -275,6 +275,15 @@ static bool CreateIsolateAndSetup(const char* name_prefix, |
if (script_snapshot_buffer != NULL) { |
library = Dart_LoadScriptFromSnapshot(script_snapshot_buffer); |
} else { |
+ // If we are not using snapshots make sure that the builtin IO |
+ // library is loaded so the main script can import it. Since we do |
+ // not have a tag handler at this point, load the libraries needed |
+ // by the IO library directly instead of relying on imports. |
+ if (snapshot_buffer == NULL) { |
+ Dart_Handle io_lib = Builtin::LoadLibrary(Builtin::kIOLibrary); |
+ Builtin::ImportLibrary(io_lib, Builtin::kNativeWrappersLibrary); |
+ Builtin::ImportLibrary(io_lib, Builtin::kCoreImplLibrary); |
+ } |
library = LoadScript(canonical_script_name); |
} |
if (Dart_IsError(library)) { |
@@ -294,11 +303,13 @@ static bool CreateIsolateAndSetup(const char* name_prefix, |
return false; |
} |
if (script_snapshot_buffer == NULL) { |
- Builtin::ImportLibrary(library); // Implicitly import builtin into app. |
+ // Implicitly import builtin into app. |
+ Builtin::ImportLibrary(library, Builtin::kBuiltinLibrary); |
} |
if (snapshot_buffer != NULL) { |
// Setup the native resolver as the snapshot does not carry it. |
- Builtin::SetNativeResolver(); |
+ Builtin::SetNativeResolver(Builtin::kBuiltinLibrary); |
+ Builtin::SetNativeResolver(Builtin::kIOLibrary); |
} |
Dart_ExitScope(); |
return true; |