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

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

Issue 22625003: Make ClosureMirror handle instances of user-defined classes that implement call. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: rebase Created 7 years, 4 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 | « runtime/lib/mirrors.cc ('k') | runtime/vm/bootstrap_natives.h » ('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 // These values are allowed to be passed directly over the wire. 9 // These values are allowed to be passed directly over the wire.
10 bool _isSimpleValue(var value) { 10 bool _isSimpleValue(var value) {
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after
625 625
626 // FunctionTypeMirrors have a simpleName generated from their signature. 626 // FunctionTypeMirrors have a simpleName generated from their signature.
627 Symbol _simpleName = null; 627 Symbol _simpleName = null;
628 Symbol get simpleName { 628 Symbol get simpleName {
629 if (_simpleName == null) { 629 if (_simpleName == null) {
630 _simpleName = _s(_makeSignatureString(returnType, parameters)); 630 _simpleName = _s(_makeSignatureString(returnType, parameters));
631 } 631 }
632 return _simpleName; 632 return _simpleName;
633 } 633 }
634 634
635 MethodMirror _callMethod;
636 MethodMirror get callMethod {
637 if (_callMethod == null) {
638 _callMethod = this._FunctionTypeMirror_call_method(_reflectee);
639 }
640 return _callMethod;
641 }
642
635 TypeMirror _returnType = null; 643 TypeMirror _returnType = null;
636 TypeMirror get returnType { 644 TypeMirror get returnType {
637 if (_returnType == null) { 645 if (_returnType == null) {
638 _returnType = 646 _returnType =
639 _Mirrors._reflectType(_FunctionTypeMirror_return_type(_reflectee)); 647 _Mirrors._reflectType(_FunctionTypeMirror_return_type(_reflectee));
640 } 648 }
641 return _returnType; 649 return _returnType;
642 } 650 }
643 651
644 List<ParameterMirror> _parameters = null; 652 List<ParameterMirror> _parameters = null;
645 List<ParameterMirror> get parameters { 653 List<ParameterMirror> get parameters {
646 if (_parameters == null) { 654 if (_parameters == null) {
647 _parameters = _FunctionTypeMirror_parameters(_reflectee); 655 _parameters = _FunctionTypeMirror_parameters(_reflectee);
648 } 656 }
649 return _parameters; 657 return _parameters;
650 } 658 }
651 659
652 Map<Symbol, Mirror> get members => new Map<Symbol,Mirror>(); 660 Map<Symbol, Mirror> get members => new Map<Symbol,Mirror>();
653 Map<Symbol, MethodMirror> get constructors => new Map<Symbol,MethodMirror>(); 661 Map<Symbol, MethodMirror> get constructors => new Map<Symbol,MethodMirror>();
654 final Map<Symbol, TypeVariableMirror> typeVariables = const {}; 662 final Map<Symbol, TypeVariableMirror> typeVariables = const {};
655 663
656 String toString() => "FunctionTypeMirror on '${_n(simpleName)}'"; 664 String toString() => "FunctionTypeMirror on '${_n(simpleName)}'";
657 665
666 MethodMirror _FunctionTypeMirror_call_method(reflectee)
667 native "FunctionTypeMirror_call_method";
668
658 static Type _FunctionTypeMirror_return_type(reflectee) 669 static Type _FunctionTypeMirror_return_type(reflectee)
659 native "FunctionTypeMirror_return_type"; 670 native "FunctionTypeMirror_return_type";
660 671
661 static List<ParameterMirror> _FunctionTypeMirror_parameters(reflectee) 672 static List<ParameterMirror> _FunctionTypeMirror_parameters(reflectee)
662 native "FunctionTypeMirror_parameters"; 673 native "FunctionTypeMirror_parameters";
663 } 674 }
664 675
665 abstract class _LocalDeclarationMirrorImpl extends _LocalMirrorImpl 676 abstract class _LocalDeclarationMirrorImpl extends _LocalMirrorImpl
666 implements DeclarationMirror { 677 implements DeclarationMirror {
667 _LocalDeclarationMirrorImpl(this._reflectee, this.simpleName); 678 _LocalDeclarationMirrorImpl(this._reflectee, this.simpleName);
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after
1193 if (typeMirror == null) { 1204 if (typeMirror == null) {
1194 typeMirror = makeLocalTypeMirror(key); 1205 typeMirror = makeLocalTypeMirror(key);
1195 _instanitationCache[key] = typeMirror; 1206 _instanitationCache[key] = typeMirror;
1196 if (typeMirror is ClassMirror && !typeMirror._isGeneric) { 1207 if (typeMirror is ClassMirror && !typeMirror._isGeneric) {
1197 _declarationCache[key] = typeMirror; 1208 _declarationCache[key] = typeMirror;
1198 } 1209 }
1199 } 1210 }
1200 return typeMirror; 1211 return typeMirror;
1201 } 1212 }
1202 } 1213 }
OLDNEW
« 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