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

Side by Side Diff: runtime/lib/mirrors_impl.dart

Issue 183923018: Work around bug where closures are missing #call to support delegation of #call to closures. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | tests/lib/lib.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 // VM-specific implementation of the dart:mirrors library. 5 // VM-specific implementation of the dart:mirrors library.
6 6
7 import "dart:collection"; 7 import "dart:collection";
8 8
9 final emptyList = new UnmodifiableListView([]); 9 final emptyList = new UnmodifiableListView([]);
10 final emptyMap = new _UnmodifiableMapView({}); 10 final emptyMap = new _UnmodifiableMapView({});
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 _LocalClosureMirror(reflectee) : super(reflectee); 468 _LocalClosureMirror(reflectee) : super(reflectee);
469 469
470 MethodMirror _function; 470 MethodMirror _function;
471 MethodMirror get function { 471 MethodMirror get function {
472 if (_function == null) { 472 if (_function == null) {
473 _function = _computeFunction(reflectee); 473 _function = _computeFunction(reflectee);
474 } 474 }
475 return _function; 475 return _function;
476 } 476 }
477 477
478 // TODO(12602): Remove this special case.
479 delegate(Invocation invocation) {
480 if (invocation.isMethod && (invocation.memberName == #call)) {
481 return this.apply(invocation.positionalArguments,
482 invocation.namedArguments);
483 }
484 return super.delegate(invocation);
485 }
486
478 InstanceMirror apply(List<Object> positionalArguments, 487 InstanceMirror apply(List<Object> positionalArguments,
479 [Map<Symbol, Object> namedArguments]) { 488 [Map<Symbol, Object> namedArguments]) {
480 // TODO(12602): When closures get an ordinary call method, this can be 489 // TODO(12602): When closures get an ordinary call method, this can be
481 // replaced with 490 // replaced with
482 // return this.invoke(#call, positionalArguments, namedArguments); 491 // return this.invoke(#call, positionalArguments, namedArguments);
483 // and the native ClosureMirror_apply can be removed. 492 // and the native ClosureMirror_apply can be removed.
484 int numPositionalArguments = positionalArguments.length + 1; // Receiver. 493 int numPositionalArguments = positionalArguments.length + 1; // Receiver.
485 int numNamedArguments = namedArguments != null ? namedArguments.length : 0; 494 int numNamedArguments = namedArguments != null ? namedArguments.length : 0;
486 int numArguments = numPositionalArguments + numNamedArguments; 495 int numArguments = numPositionalArguments + numNamedArguments;
487 List arguments = new List(numArguments); 496 List arguments = new List(numArguments);
(...skipping 1158 matching lines...) Expand 10 before | Expand all | Expand 10 after
1646 if (typeMirror == null) { 1655 if (typeMirror == null) {
1647 typeMirror = makeLocalTypeMirror(key); 1656 typeMirror = makeLocalTypeMirror(key);
1648 _instanitationCache[key] = typeMirror; 1657 _instanitationCache[key] = typeMirror;
1649 if (typeMirror is ClassMirror && !typeMirror._isGeneric) { 1658 if (typeMirror is ClassMirror && !typeMirror._isGeneric) {
1650 _declarationCache[key] = typeMirror; 1659 _declarationCache[key] = typeMirror;
1651 } 1660 }
1652 } 1661 }
1653 return typeMirror; 1662 return typeMirror;
1654 } 1663 }
1655 } 1664 }
OLDNEW
« 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