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

Unified Diff: runtime/vm/mirrors_api_impl.cc

Issue 17582016: Convert implementation in mirrors.cc to use Dart_GetType instead of Dart_GetClass. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 6 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
« runtime/lib/mirrors.cc ('K') | « runtime/lib/mirrors.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/mirrors_api_impl.cc
===================================================================
--- runtime/vm/mirrors_api_impl.cc (revision 24443)
+++ runtime/vm/mirrors_api_impl.cc (working copy)
@@ -221,8 +221,12 @@
Function& func = Function::Handle();
String& name = String::Handle();
- if (obj.IsClass()) {
- const Class& cls = Class::Cast(obj);
+ if (obj.IsType() || obj.IsClass()) {
+ // For backwards compatibility we allow class objects to be passed in
+ // for now. This needs to be removed once all code that uses class
+ // objects to invoke Dart_Invoke is removed.
+ const Class& cls = (obj.IsType()) ?
+ Class::Handle(Type::Cast(obj).type_class()) : Class::Cast(obj);
const Error& error = Error::Handle(isolate, cls.EnsureIsFinalized(isolate));
if (!error.IsNull()) {
return Api::NewHandle(isolate, error.raw());
@@ -283,8 +287,12 @@
Function& func = Function::Handle(isolate);
String& tmp_name = String::Handle(isolate);
- if (obj.IsClass()) {
- const Class& cls = Class::Cast(obj);
+ if (obj.IsType() || obj.IsClass()) {
+ // For backwards compatibility we allow class objects to be passed in
+ // for now. This needs to be removed once all code that uses class
+ // objects to invoke Dart_Invoke is removed.
+ const Class& cls = (obj.IsType()) ?
+ Class::Handle(Type::Cast(obj).type_class()) : Class::Cast(obj);
// Case 1. Lookup the unmodified function name.
func = cls.LookupFunctionAllowPrivate(func_name);
@@ -561,8 +569,12 @@
Field& field = Field::Handle(isolate);
String& name = String::Handle(isolate);
- if (obj.IsClass()) {
- const Class& cls = Class::Cast(obj);
+ if (obj.IsType() || obj.IsClass()) {
+ // For backwards compatibility we allow class objects to be passed in
+ // for now. This needs to be removed once all code that uses class
+ // objects to invoke Dart_Invoke is removed.
+ const Class& cls = (obj.IsType()) ?
+ Class::Handle(Type::Cast(obj).type_class()) : Class::Cast(obj);
const Error& error = Error::Handle(isolate, cls.EnsureIsFinalized(isolate));
if (!error.IsNull()) {
return Api::NewHandle(isolate, error.raw());
@@ -614,8 +626,12 @@
if (var_name.IsNull()) {
RETURN_TYPE_ERROR(isolate, variable_name, String);
}
- if (obj.IsClass()) {
- const Class& cls = Class::Cast(obj);
+ if (obj.IsType() || obj.IsClass()) {
+ // For backwards compatibility we allow class objects to be passed in
+ // for now. This needs to be removed once all code that uses class
+ // objects to invoke Dart_Invoke is removed.
+ const Class& cls = (obj.IsType()) ?
+ Class::Handle(Type::Cast(obj).type_class()) : Class::Cast(obj);
return Api::NewHandle(isolate, cls.LookupField(var_name));
}
if (obj.IsLibrary()) {
« runtime/lib/mirrors.cc ('K') | « runtime/lib/mirrors.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698