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

Unified Diff: vm/object.cc

Issue 10433003: Make Dart_GetClass work for private classes. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 7 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
« vm/object.h ('K') | « vm/object.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: vm/object.cc
===================================================================
--- vm/object.cc (revision 7921)
+++ vm/object.cc (working copy)
@@ -5190,6 +5190,33 @@
}
+RawClass* Library::LookupClassAllowPrivate(const String& name) const {
+ // See if the class is available in this library or in the top level
+ // scope of any imported library.
+ Isolate* isolate = Isolate::Current();
+ Class& cls = Class::Handle(isolate);
+ cls = LookupClass(name);
+ if (!cls.IsNull()) {
+ return cls.raw();
+ }
+
+ // Now try to lookup the class using its private name, but only in
+ // this library (not in imported libraries).
+ if (ShouldBePrivate(name)) {
+ String& private_name = String::Handle(isolate, PrivateName(name));
+ const Object& obj = Object::Handle(LookupLocalObject(private_name));
+ if (!obj.IsNull()) {
+ if (obj.IsClass()) {
+ cls ^= obj.raw();
+ return cls.raw();
+ }
+ }
+ }
+
+ return Class::null();
+}
+
+
RawLibraryPrefix* Library::LookupLocalLibraryPrefix(const String& name) const {
Object& obj = Object::Handle(LookupLocalObject(name));
if (!obj.IsNull() && obj.IsLibraryPrefix()) {
« vm/object.h ('K') | « vm/object.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698