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

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: 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
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 592 matching lines...) Expand 10 before | Expand all | Expand 10 after
603 603
604 // FunctionTypeMirrors have a simpleName generated from their signature. 604 // FunctionTypeMirrors have a simpleName generated from their signature.
605 Symbol _simpleName = null; 605 Symbol _simpleName = null;
606 Symbol get simpleName { 606 Symbol get simpleName {
607 if (_simpleName == null) { 607 if (_simpleName == null) {
608 _simpleName = _s(_makeSignatureString(returnType, parameters)); 608 _simpleName = _s(_makeSignatureString(returnType, parameters));
609 } 609 }
610 return _simpleName; 610 return _simpleName;
611 } 611 }
612 612
613 MethodMirror _callMethod;
614 MethodMirror get callMethod {
615 if (_callMethod==null) {
siva 2013/08/07 23:06:41 missing spaces: if (_callMethod == null) {
616 _callMethod = this._FunctionTypeMirror_call_method(_reflectee);
617 }
618 return _callMethod;
619 }
620
613 TypeMirror _returnType = null; 621 TypeMirror _returnType = null;
614 TypeMirror get returnType { 622 TypeMirror get returnType {
615 if (_returnType == null) { 623 if (_returnType == null) {
616 _returnType = _FunctionTypeMirror_return_type(_reflectee); 624 _returnType = _FunctionTypeMirror_return_type(_reflectee);
617 } 625 }
618 return _returnType; 626 return _returnType;
619 } 627 }
620 628
621 List<ParameterMirror> _parameters = null; 629 List<ParameterMirror> _parameters = null;
622 List<ParameterMirror> get parameters { 630 List<ParameterMirror> get parameters {
623 if (_parameters == null) { 631 if (_parameters == null) {
624 _parameters = _FunctionTypeMirror_parameters(_reflectee); 632 _parameters = _FunctionTypeMirror_parameters(_reflectee);
625 } 633 }
626 return _parameters; 634 return _parameters;
627 } 635 }
628 636
629 Map<Symbol, Mirror> get members => new Map<Symbol,Mirror>(); 637 Map<Symbol, Mirror> get members => new Map<Symbol,Mirror>();
630 Map<Symbol, MethodMirror> get constructors => new Map<Symbol,MethodMirror>(); 638 Map<Symbol, MethodMirror> get constructors => new Map<Symbol,MethodMirror>();
631 final Map<Symbol, TypeVariableMirror> typeVariables = const {}; 639 final Map<Symbol, TypeVariableMirror> typeVariables = const {};
632 640
633 String toString() => "FunctionTypeMirror on '${_n(simpleName)}'"; 641 String toString() => "FunctionTypeMirror on '${_n(simpleName)}'";
634 642
643 MethodMirror _FunctionTypeMirror_call_method(reflectee)
644 native "FunctionTypeMirror_call_method";
645
635 static TypeMirror _FunctionTypeMirror_return_type(reflectee) 646 static TypeMirror _FunctionTypeMirror_return_type(reflectee)
636 native "FunctionTypeMirror_return_type"; 647 native "FunctionTypeMirror_return_type";
637 648
638 static List<ParameterMirror> _FunctionTypeMirror_parameters(reflectee) 649 static List<ParameterMirror> _FunctionTypeMirror_parameters(reflectee)
639 native "FunctionTypeMirror_parameters"; 650 native "FunctionTypeMirror_parameters";
640 } 651 }
641 652
642 abstract class _LocalDeclarationMirrorImpl extends _LocalMirrorImpl 653 abstract class _LocalDeclarationMirrorImpl extends _LocalMirrorImpl
643 implements DeclarationMirror { 654 implements DeclarationMirror {
644 _LocalDeclarationMirrorImpl(this._reflectee, this.simpleName); 655 _LocalDeclarationMirrorImpl(this._reflectee, this.simpleName);
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after
1142 static Expando<ClassMirror> _classMirrorCache = new Expando("ClassMirror"); 1153 static Expando<ClassMirror> _classMirrorCache = new Expando("ClassMirror");
1143 static ClassMirror reflectClass(Type key) { 1154 static ClassMirror reflectClass(Type key) {
1144 var classMirror = _classMirrorCache[key]; 1155 var classMirror = _classMirrorCache[key];
1145 if (classMirror == null) { 1156 if (classMirror == null) {
1146 classMirror = makeLocalClassMirror(key); 1157 classMirror = makeLocalClassMirror(key);
1147 _classMirrorCache[key] = classMirror; 1158 _classMirrorCache[key] = classMirror;
1148 } 1159 }
1149 return classMirror; 1160 return classMirror;
1150 } 1161 }
1151 } 1162 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698