| 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()) {
|
|
|