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

Unified Diff: runtime/lib/mirrors.cc

Issue 196953007: Fix LibraryMirror.invoke to call through the contents of an implicit getter. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: split multitest for easier marking of dart2js partial failures Created 6 years, 9 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 | « no previous file | tests/lib/lib.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/lib/mirrors.cc
diff --git a/runtime/lib/mirrors.cc b/runtime/lib/mirrors.cc
index 6df614d919678df12f96d7223b14031d31b7f275..098ef1ef853c88224f8c88a136f37d12116c2f79 100644
--- a/runtime/lib/mirrors.cc
+++ b/runtime/lib/mirrors.cc
@@ -1976,37 +1976,27 @@ DEFINE_NATIVE_ENTRY(LibraryMirror_invoke, 5) {
if (function.IsNull()) {
// Didn't find a method: try to find a getter and invoke call on its result.
- const String& getter_name =
- String::Handle(Field::GetterName(function_name));
- function = library.LookupLocalFunction(getter_name);
- if (!function.IsNull()) {
- // Invoke getter.
- const Object& getter_result = Object::Handle(
- DartEntry::InvokeFunction(function, Object::empty_array()));
- if (getter_result.IsError()) {
- ThrowInvokeError(Error::Cast(getter_result));
- UNREACHABLE();
- }
- // Make room for the closure (receiver) in arguments.
- intptr_t numArgs = args.Length();
- const Array& call_args = Array::Handle(Array::New(numArgs + 1));
- Object& temp = Object::Handle();
- for (int i = 0; i < numArgs; i++) {
- temp = args.At(i);
- call_args.SetAt(i + 1, temp);
- }
- call_args.SetAt(0, getter_result);
- const Array& call_args_descriptor_array =
- Array::Handle(ArgumentsDescriptor::New(call_args.Length(), arg_names));
- // Call closure.
- const Object& call_result = Object::Handle(
- DartEntry::InvokeClosure(call_args, call_args_descriptor_array));
- if (call_result.IsError()) {
- ThrowInvokeError(Error::Cast(call_result));
- UNREACHABLE();
- }
- return call_result.raw();
+ const Instance& getter_result =
+ Instance::Handle(InvokeLibraryGetter(library, function_name, true));
+ // Make room for the closure (receiver) in arguments.
+ intptr_t numArgs = args.Length();
+ const Array& call_args = Array::Handle(Array::New(numArgs + 1));
+ Object& temp = Object::Handle();
+ for (int i = 0; i < numArgs; i++) {
+ temp = args.At(i);
+ call_args.SetAt(i + 1, temp);
+ }
+ call_args.SetAt(0, getter_result);
+ const Array& call_args_descriptor_array =
+ Array::Handle(ArgumentsDescriptor::New(call_args.Length(), arg_names));
+ // Call closure.
+ const Object& call_result = Object::Handle(
+ DartEntry::InvokeClosure(call_args, call_args_descriptor_array));
+ if (call_result.IsError()) {
+ ThrowInvokeError(Error::Cast(call_result));
+ UNREACHABLE();
}
+ return call_result.raw();
}
const Array& args_descriptor_array =
« no previous file with comments | « no previous file | tests/lib/lib.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698