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

Unified Diff: runtime/vm/object.cc

Issue 10949028: Fix for issue 5223 : Import 'dart:core' implicitly only if it has not been (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 3 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/parser.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object.cc
===================================================================
--- runtime/vm/object.cc (revision 12667)
+++ runtime/vm/object.cc (working copy)
@@ -6487,6 +6487,32 @@
}
+bool Library::ImportsCorelib() const {
+ Isolate* isolate = Isolate::Current();
+ Library& imported = Library::Handle(isolate);
+ intptr_t count = num_imports();
+ for (int i = 0; i < count; i++) {
+ imported = ImportAt(i);
+ if (imported.IsCoreLibrary()) {
+ return true;
+ }
+ }
+ LibraryPrefix& prefix = LibraryPrefix::Handle(isolate);
+ LibraryPrefixIterator it(*this);
+ while (it.HasNext()) {
+ prefix = it.GetNext();
+ count = prefix.num_libs();
+ for (int i = 0; i < count; i++) {
+ imported = prefix.GetLibrary(i);
+ if (imported.IsCoreLibrary()) {
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
+
void Library::AddImport(const Library& library) const {
Array& imports = Array::Handle(this->imports());
intptr_t capacity = imports.Length();
@@ -6558,7 +6584,7 @@
RawLibrary* Library::New(const String& url) {
- return NewLibraryHelper(url, true);
+ return NewLibraryHelper(url, false);
}
@@ -6592,7 +6618,7 @@
void Library::InitMathLibrary(Isolate* isolate) {
const String& url = String::Handle(Symbols::New("dart:math"));
- const Library& lib = Library::Handle(Library::New(url));
+ const Library& lib = Library::Handle(Library::NewLibraryHelper(url, true));
lib.Register();
const Library& core_impl_lib = Library::Handle(Library::CoreImplLibrary());
lib.AddImport(core_impl_lib);
@@ -6602,7 +6628,7 @@
void Library::InitIsolateLibrary(Isolate* isolate) {
const String& url = String::Handle(Symbols::New("dart:isolate"));
- const Library& lib = Library::Handle(Library::New(url));
+ const Library& lib = Library::Handle(Library::NewLibraryHelper(url, true));
lib.Register();
isolate->object_store()->set_isolate_library(lib);
}
@@ -6610,7 +6636,7 @@
void Library::InitMirrorsLibrary(Isolate* isolate) {
const String& url = String::Handle(Symbols::New("dart:mirrors"));
- const Library& lib = Library::Handle(Library::New(url));
+ const Library& lib = Library::Handle(Library::NewLibraryHelper(url, true));
lib.Register();
const Library& isolate_lib = Library::Handle(Library::IsolateLibrary());
lib.AddImport(isolate_lib);
@@ -6623,7 +6649,7 @@
void Library::InitScalarlistLibrary(Isolate* isolate) {
const String& url = String::Handle(Symbols::New("dart:scalarlist"));
- const Library& lib = Library::Handle(Library::New(url));
+ const Library& lib = Library::Handle(Library::NewLibraryHelper(url, true));
lib.Register();
const Library& core_impl_lib = Library::Handle(Library::CoreImplLibrary());
lib.AddImport(core_impl_lib);
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698