Chromium Code Reviews| Index: runtime/vm/object.cc |
| diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc |
| index 2b404c275547a67604edd9aaac15c508b06ddf0d..0b7ed534914b1d0f23dd3d3de0b67b315ee8cde0 100644 |
| --- a/runtime/vm/object.cc |
| +++ b/runtime/vm/object.cc |
| @@ -925,6 +925,22 @@ RawError* Object::Init(Isolate* isolate) { |
| if (!error.IsNull()) { |
| return error.raw(); |
| } |
| + const Script& collection_script = |
| + Script::Handle(Bootstrap::LoadCollectionScript(false)); |
| + const Library& collection_lib = |
| + Library::Handle(Library::CollectionLibrary()); |
| + ASSERT(!collection_lib.IsNull()); |
| + error = Bootstrap::Compile(collection_lib, collection_script); |
| + if (!error.IsNull()) { |
| + return error.raw(); |
| + } |
| + /* |
| + patch_script = Bootstrap::LoadMathScript(true); |
|
floitsch
2012/10/26 12:31:28
Remove commented code.
Anders Johnsen
2012/11/12 12:07:13
Done.
|
| + error = math_lib.Patch(patch_script); |
| + if (!error.IsNull()) { |
| + return error.raw(); |
| + } |
| + */ |
| const Script& math_script = Script::Handle(Bootstrap::LoadMathScript(false)); |
| const Library& math_lib = Library::Handle(Library::MathLibrary()); |
| ASSERT(!math_lib.IsNull()); |
| @@ -5941,8 +5957,15 @@ void Library::InitCoreLibrary(Isolate* isolate) { |
| const Library& math_lib = Library::Handle(Library::MathLibrary()); |
| const Namespace& math_ns = Namespace::Handle( |
| Namespace::New(math_lib, Array::Handle(), Array::Handle())); |
| + Library::InitCollectionLibrary(isolate); |
| + const Library& collection_lib = |
| + Library::Handle(Library::CollectionLibrary()); |
| + const Namespace& collection_ns = Namespace::Handle( |
| + Namespace::New(collection_lib, Array::Handle(), Array::Handle())); |
| core_lib.AddImport(math_ns); |
| core_impl_lib.AddImport(math_ns); |
| + core_lib.AddImport(collection_ns); |
| + core_impl_lib.AddImport(collection_ns); |
| isolate->object_store()->set_root_library(Library::Handle()); |
| // Hook up predefined classes without setting their library pointers. These |
| @@ -5953,6 +5976,18 @@ void Library::InitCoreLibrary(Isolate* isolate) { |
| } |
| +void Library::InitCollectionLibrary(Isolate* isolate) { |
| + const String& url = String::Handle(Symbols::New("dart:collection")); |
| + const Library& lib = Library::Handle(Library::NewLibraryHelper(url, true)); |
| + lib.Register(); |
| + const Library& math_lib = Library::Handle(Library::MathLibrary()); |
| + const Namespace& math_ns = Namespace::Handle( |
| + Namespace::New(math_lib, Array::Handle(), Array::Handle())); |
| + lib.AddImport(math_ns); |
| + isolate->object_store()->set_collection_library(lib); |
| +} |
| + |
| + |
| void Library::InitMathLibrary(Isolate* isolate) { |
| const String& url = String::Handle(Symbols::New("dart:math")); |
| const Library& lib = Library::Handle(Library::NewLibraryHelper(url, true)); |
| @@ -5994,10 +6029,11 @@ void Library::InitScalarlistLibrary(Isolate* isolate) { |
| const String& url = String::Handle(Symbols::New("dart:scalarlist")); |
| const Library& lib = Library::Handle(Library::NewLibraryHelper(url, true)); |
| lib.Register(); |
| - const Library& core_impl_lib = Library::Handle(Library::CoreImplLibrary()); |
| - const Namespace& impl_ns = Namespace::Handle( |
| - Namespace::New(core_impl_lib, Array::Handle(), Array::Handle())); |
| - lib.AddImport(impl_ns); |
| + const Library& collection_lib = |
| + Library::Handle(Library::CollectionLibrary()); |
| + const Namespace& collection_ns = Namespace::Handle( |
| + Namespace::New(collection_lib, Array::Handle(), Array::Handle())); |
| + lib.AddImport(collection_ns); |
| isolate->object_store()->set_scalarlist_library(lib); |
| } |
| @@ -6115,6 +6151,11 @@ RawLibrary* Library::CoreImplLibrary() { |
| } |
| +RawLibrary* Library::CollectionLibrary() { |
| + return Isolate::Current()->object_store()->collection_library(); |
| +} |
| + |
| + |
| RawLibrary* Library::MathLibrary() { |
| return Isolate::Current()->object_store()->math_library(); |
| } |