Index: runtime/vm/bootstrap.cc |
diff --git a/runtime/vm/bootstrap.cc b/runtime/vm/bootstrap.cc |
index 8c1d68c0e5bf7e0b0b68330045e8fc0e28646da0..958fa949e4c96d7ab229e564768ad63d321596fe 100644 |
--- a/runtime/vm/bootstrap.cc |
+++ b/runtime/vm/bootstrap.cc |
@@ -38,6 +38,40 @@ RawScript* Bootstrap::LoadImplScript() { |
} |
+static RawObject* InitLibrary(const char* url_str, const char* source_str) { |
+ const String& url = String::Handle(String::NewSymbol(url_str)); |
+ const String& source = String::Handle(String::New(source_str, Heap::kOld)); |
+ const Library& lib = Library::Handle(Library::New(url)); |
+ lib.Register(); |
+ const Script& script = |
+ Script::Handle(Script::New(url, source, RawScript::kSource)); |
+ const Error& error = Error::Handle(Bootstrap::Compile(lib, script)); |
+ if (!error.IsNull()) { |
+ return error.raw(); |
+ } else { |
+ return lib.raw(); |
+ } |
+} |
+ |
+ |
+RawError* Bootstrap::InitAdditionalLibraries() { |
Ivan Posva
2012/02/25 00:14:38
As we are planning to completely revamp the way li
Siggi Cherem (dart-lang)
2012/02/25 02:10:38
Done.
|
+ Object& result = Object::Handle(); |
+ |
+ result = InitLibrary("dart:isolate", isolate_source_); |
+ if (result.IsError()) { |
+ Error& error = Error::Handle(); |
+ error ^= result.raw(); |
+ return error.raw(); |
+ } else { |
+ Library& lib = Library::Handle(); |
+ lib ^= result.raw(); |
+ Isolate::Current()->object_store()->set_isolate_library(lib); |
+ } |
+ |
+ return Error::null(); |
+} |
+ |
+ |
RawError* Bootstrap::Compile(const Library& library, const Script& script) { |
if (FLAG_print_bootstrap) { |
OS::Print("Bootstrap source '%s':\n%s\n", |
@@ -48,6 +82,8 @@ RawError* Bootstrap::Compile(const Library& library, const Script& script) { |
const Error& error = Error::Handle(Compiler::Compile(library, script)); |
if (error.IsNull()) { |
library.SetLoaded(); |
+ } else { |
+ library.SetLoadError(); |
} |
return error.raw(); |
} |