Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(794)

Unified Diff: runtime/vm/object.cc

Issue 11274043: Move Arrays, Collections and Maps into a new library, dart:collections. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Review update. Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: runtime/vm/object.cc
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index 2b404c275547a67604edd9aaac15c508b06ddf0d..6ec8987a4d09d13ec55c472ac196df5f791af019 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& collections_script =
+ Script::Handle(Bootstrap::LoadCollectionsScript(false));
+ const Library& collections_lib =
+ Library::Handle(Library::CollectionsLibrary());
+ ASSERT(!collections_lib.IsNull());
+ error = Bootstrap::Compile(collections_lib, collections_script);
+ if (!error.IsNull()) {
+ return error.raw();
+ }
+ /*
Anton Muhin 2012/10/25 12:52:52 commented out code
+ patch_script = Bootstrap::LoadMathScript(true);
+ 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::InitCollectionsLibrary(isolate);
+ const Library& collections_lib =
+ Library::Handle(Library::CollectionsLibrary());
+ const Namespace& collections_ns = Namespace::Handle(
+ Namespace::New(collections_lib, Array::Handle(), Array::Handle()));
core_lib.AddImport(math_ns);
core_impl_lib.AddImport(math_ns);
+ core_lib.AddImport(collections_ns);
+ core_impl_lib.AddImport(collections_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::InitCollectionsLibrary(Isolate* isolate) {
+ const String& url = String::Handle(Symbols::New("dart:collections"));
+ 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_collections_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& collections_lib =
+ Library::Handle(Library::CollectionsLibrary());
+ const Namespace& collections_ns = Namespace::Handle(
+ Namespace::New(collections_lib, Array::Handle(), Array::Handle()));
+ lib.AddImport(collections_ns);
isolate->object_store()->set_scalarlist_library(lib);
}
@@ -6115,6 +6151,11 @@ RawLibrary* Library::CoreImplLibrary() {
}
+RawLibrary* Library::CollectionsLibrary() {
+ return Isolate::Current()->object_store()->collections_library();
+}
+
+
RawLibrary* Library::MathLibrary() {
return Isolate::Current()->object_store()->math_library();
}

Powered by Google App Engine
This is Rietveld 408576698