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

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: Remove uncommented code. 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
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/object_store.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object.cc
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index b8cb1961b1ce6096b783f7b57e52e353dc93b849..66b5de113ffba81d656fae00f49040ed50c8463d 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -925,6 +925,15 @@ 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();
+ }
const Script& math_script = Script::Handle(Bootstrap::LoadMathScript(false));
const Library& math_lib = Library::Handle(Library::MathLibrary());
ASSERT(!math_lib.IsNull());
@@ -5941,8 +5950,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 +5969,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 +6022,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 +6144,11 @@ RawLibrary* Library::CoreImplLibrary() {
}
+RawLibrary* Library::CollectionLibrary() {
+ return Isolate::Current()->object_store()->collection_library();
+}
+
+
RawLibrary* Library::MathLibrary() {
return Isolate::Current()->object_store()->math_library();
}
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/object_store.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698