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

Unified Diff: runtime/lib/mirrors_impl.dart

Issue 196513004: Clean up ClosureMirror.invoke(#call, ...). (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: adapt to alternate implementation of closure.call 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 | « runtime/lib/mirrors.cc ('k') | runtime/vm/bootstrap_natives.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/lib/mirrors_impl.dart
diff --git a/runtime/lib/mirrors_impl.dart b/runtime/lib/mirrors_impl.dart
index bb8b56ee864e6a2a9ee083a5916ab9c368db07f7..800b2b69b0bbdf5c471dd32689bcac5829afaeb2 100644
--- a/runtime/lib/mirrors_impl.dart
+++ b/runtime/lib/mirrors_impl.dart
@@ -446,40 +446,9 @@ class _LocalClosureMirror extends _LocalInstanceMirror
return _function;
}
- // TODO(12602): Remove this special case.
- delegate(Invocation invocation) {
- if (invocation.isMethod && (invocation.memberName == #call)) {
- return this.apply(invocation.positionalArguments,
- invocation.namedArguments).reflectee;
- }
- return super.delegate(invocation);
- }
-
InstanceMirror apply(List<Object> positionalArguments,
[Map<Symbol, Object> namedArguments]) {
- // TODO(12602): When closures get an ordinary call method, this can be
- // replaced with
- // return this.invoke(#call, positionalArguments, namedArguments);
- // and the native ClosureMirror_apply can be removed.
- int numPositionalArguments = positionalArguments.length + 1; // Receiver.
- int numNamedArguments = namedArguments != null ? namedArguments.length : 0;
- int numArguments = numPositionalArguments + numNamedArguments;
- List arguments = new List(numArguments);
- arguments[0] = _reflectee; // Receiver.
- arguments.setRange(1, numPositionalArguments, positionalArguments);
- List names = new List(numNamedArguments);
- int argumentIndex = numPositionalArguments;
- int nameIndex = 0;
- if (numNamedArguments > 0) {
- namedArguments.forEach((name, value) {
- arguments[argumentIndex++] = value;
- names[nameIndex++] = _n(name);
- });
- }
-
- // It is tempting to implement this in terms of Function.apply, but then
- // lazy compilation errors would be fatal.
- return reflect(_apply(arguments, names));
+ return this.invoke(#call, positionalArguments, namedArguments);
}
InstanceMirror findInContext(Symbol name, {ifAbsent: null}) {
« no previous file with comments | « runtime/lib/mirrors.cc ('k') | runtime/vm/bootstrap_natives.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698