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

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

Issue 22292002: Reflection on generics. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: address generic equality 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 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 // TODO(ahe): This is a hack, see delegate below. 244 // TODO(ahe): This is a hack, see delegate below.
245 static Function _invokeOnClosure; 245 static Function _invokeOnClosure;
246 246
247 _LocalInstanceMirrorImpl(reflectee) : super(reflectee); 247 _LocalInstanceMirrorImpl(reflectee) : super(reflectee);
248 248
249 ClassMirror _type; 249 ClassMirror _type;
250 ClassMirror get type { 250 ClassMirror get type {
251 if (_type == null) { 251 if (_type == null) {
252 // Note it not safe to use reflectee.runtimeType because runtimeType may 252 // Note it not safe to use reflectee.runtimeType because runtimeType may
253 // be overridden. 253 // be overridden.
254 _type = reflectClass(_computeType(reflectee)); 254 _type = _Mirrors._reflectType(_computeType(reflectee));
255 } 255 }
256 return _type; 256 return _type;
257 } 257 }
258 258
259 // LocalInstanceMirrors always reflect local instances 259 // LocalInstanceMirrors always reflect local instances
260 bool hasReflectee = true; 260 bool hasReflectee = true;
261 261
262 get reflectee => _reflectee; 262 get reflectee => _reflectee;
263 263
264 delegate(Invocation invocation) { 264 delegate(Invocation invocation) {
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 static _apply(reflectee, positionalArguments) 353 static _apply(reflectee, positionalArguments)
354 native 'ClosureMirror_apply'; 354 native 'ClosureMirror_apply';
355 355
356 static _computeFunction(reflectee) 356 static _computeFunction(reflectee)
357 native 'ClosureMirror_function'; 357 native 'ClosureMirror_function';
358 } 358 }
359 359
360 class _LocalClassMirrorImpl extends _LocalObjectMirrorImpl 360 class _LocalClassMirrorImpl extends _LocalObjectMirrorImpl
361 implements ClassMirror { 361 implements ClassMirror {
362 _LocalClassMirrorImpl(reflectee, 362 _LocalClassMirrorImpl(reflectee,
363 String simpleName) 363 this._reflectedType,
364 String simpleName,
365 this._isGeneric)
364 : this._simpleName = _s(simpleName), 366 : this._simpleName = _s(simpleName),
365 super(reflectee); 367 super(reflectee);
366 368
369 final Type _reflectedType;
370 final bool _isGeneric;
371
367 Symbol _simpleName; 372 Symbol _simpleName;
368 Symbol get simpleName { 373 Symbol get simpleName {
369 // dynamic, void and the function types have their names set eagerly in the 374 // dynamic, void and the function types have their names set eagerly in the
370 // constructor. 375 // constructor.
371 if(_simpleName == null) { 376 if(_simpleName == null) {
372 _simpleName = _s(_name(_reflectee)); 377 _simpleName = _s(_name(_reflectee));
373 } 378 }
374 return _simpleName; 379 return _simpleName;
375 } 380 }
376 381
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 var mirror; 499 var mirror;
495 for (var i = 0; i < params.length; i += 2) { 500 for (var i = 0; i < params.length; i += 2) {
496 mirror = new _LocalTypeVariableMirrorImpl( 501 mirror = new _LocalTypeVariableMirrorImpl(
497 params[i + 1], params[i], this); 502 params[i + 1], params[i], this);
498 _typeVariables[mirror.simpleName] = mirror; 503 _typeVariables[mirror.simpleName] = mirror;
499 } 504 }
500 } 505 }
501 return _typeVariables; 506 return _typeVariables;
502 } 507 }
503 508
509 Map<Symbol, TypeMirror> _typeArguments = null;
504 Map<Symbol, TypeMirror> get typeArguments { 510 Map<Symbol, TypeMirror> get typeArguments {
505 throw new UnimplementedError( 511 if(_typeArguments == null) {
506 'ClassMirror.typeArguments is not implemented'); 512 if(_reflectedType == null) {
513 _typeArguments = new LinkedHashMap<Symbol, TypeMirror>();
514 } else {
515 _typeArguments =
516 new LinkedHashMap<Symbol, TypeMirror>.fromIterables(typeVariables.ke ys,
517 _computeTypeArgu ments(_reflectedType));
regis 2013/08/08 17:06:34 Are we OK with such long lines? Just asking, not a
rmacnak 2013/08/08 20:04:06 The style-guide only discourages lines over 80 col
518 }
519 }
520 return _typeArguments;
507 } 521 }
508 522
509 bool get isOriginalDeclaration { 523 bool get isOriginalDeclaration {
510 throw new UnimplementedError( 524 return !_isGeneric || _reflectedType == null;
511 'ClassMirror.isOriginalDeclaration is not implemented');
512 } 525 }
513 526
514 ClassMirror get genericDeclaration { 527 ClassMirror get originalDeclaration {
515 throw new UnimplementedError( 528 if (isOriginalDeclaration) {
516 'ClassMirror.originalDeclaration is not implemented'); 529 return this;
530 } else {
531 return reflectClass(_reflectedType);
532 }
517 } 533 }
518 534
519 String toString() { 535 String toString() {
520 return "ClassMirror on '${_n(simpleName)}'"; 536 return "ClassMirror on '${_n(simpleName)}'";
521 } 537 }
522 538
523 InstanceMirror newInstance(Symbol constructorName, 539 InstanceMirror newInstance(Symbol constructorName,
524 List positionalArguments, 540 List positionalArguments,
525 [Map<Symbol, dynamic> namedArguments]) { 541 [Map<Symbol, dynamic> namedArguments]) {
526 if (namedArguments != null) { 542 if (namedArguments != null) {
(...skipping 24 matching lines...) Expand all
551 } 567 }
552 568
553 List<InstanceMirror> get metadata { 569 List<InstanceMirror> get metadata {
554 // Get the metadata objects, convert them into InstanceMirrors using 570 // Get the metadata objects, convert them into InstanceMirrors using
555 // reflect() and then make them into a Dart list. 571 // reflect() and then make them into a Dart list.
556 return _metadata(_reflectee).map(reflect).toList(growable:false); 572 return _metadata(_reflectee).map(reflect).toList(growable:false);
557 } 573 }
558 574
559 bool operator ==(other) { 575 bool operator ==(other) {
560 return this.runtimeType == other.runtimeType && 576 return this.runtimeType == other.runtimeType &&
561 this._reflectee == other._reflectee; 577 this._reflectee == other._reflectee &&
578 (isOriginalDeclaration ||
579 this._reflectedType == other._reflectedType);
562 } 580 }
563 581
564 int get hashCode => simpleName.hashCode; 582 int get hashCode => simpleName.hashCode;
565 583
566 static _name(reflectee) 584 static _name(reflectee)
567 native "ClassMirror_name"; 585 native "ClassMirror_name";
568 586
569 static _library(reflectee) 587 static _library(reflectee)
570 native "ClassMirror_library"; 588 native "ClassMirror_library";
571 589
(...skipping 16 matching lines...) Expand all
588 native 'ClassMirror_invokeGetter'; 606 native 'ClassMirror_invokeGetter';
589 607
590 _invokeSetter(reflectee, setterName, value) 608 _invokeSetter(reflectee, setterName, value)
591 native 'ClassMirror_invokeSetter'; 609 native 'ClassMirror_invokeSetter';
592 610
593 static _invokeConstructor(reflectee, constructorName, positionalArguments) 611 static _invokeConstructor(reflectee, constructorName, positionalArguments)
594 native 'ClassMirror_invokeConstructor'; 612 native 'ClassMirror_invokeConstructor';
595 613
596 static _ClassMirror_type_variables(reflectee) 614 static _ClassMirror_type_variables(reflectee)
597 native "ClassMirror_type_variables"; 615 native "ClassMirror_type_variables";
616
617 static _computeTypeArguments(reflectee)
618 native "ClassMirror_type_arguments";
598 } 619 }
599 620
600 class _LocalFunctionTypeMirrorImpl extends _LocalClassMirrorImpl 621 class _LocalFunctionTypeMirrorImpl extends _LocalClassMirrorImpl
601 implements FunctionTypeMirror { 622 implements FunctionTypeMirror {
602 _LocalFunctionTypeMirrorImpl(reflectee) : super(reflectee, null); 623 _LocalFunctionTypeMirrorImpl(reflectee, reflectedType)
624 : super(reflectee, reflectedType, null, false);
603 625
604 // FunctionTypeMirrors have a simpleName generated from their signature. 626 // FunctionTypeMirrors have a simpleName generated from their signature.
605 Symbol _simpleName = null; 627 Symbol _simpleName = null;
606 Symbol get simpleName { 628 Symbol get simpleName {
607 if (_simpleName == null) { 629 if (_simpleName == null) {
608 _simpleName = _s(_makeSignatureString(returnType, parameters)); 630 _simpleName = _s(_makeSignatureString(returnType, parameters));
609 } 631 }
610 return _simpleName; 632 return _simpleName;
611 } 633 }
612 634
613 TypeMirror _returnType = null; 635 TypeMirror _returnType = null;
614 TypeMirror get returnType { 636 TypeMirror get returnType {
615 if (_returnType == null) { 637 if (_returnType == null) {
616 _returnType = _FunctionTypeMirror_return_type(_reflectee); 638 _returnType =
639 _Mirrors._reflectType(_FunctionTypeMirror_return_type(_reflectee));
617 } 640 }
618 return _returnType; 641 return _returnType;
619 } 642 }
620 643
621 List<ParameterMirror> _parameters = null; 644 List<ParameterMirror> _parameters = null;
622 List<ParameterMirror> get parameters { 645 List<ParameterMirror> get parameters {
623 if (_parameters == null) { 646 if (_parameters == null) {
624 _parameters = _FunctionTypeMirror_parameters(_reflectee); 647 _parameters = _FunctionTypeMirror_parameters(_reflectee);
625 } 648 }
626 return _parameters; 649 return _parameters;
627 } 650 }
628 651
629 Map<Symbol, Mirror> get members => new Map<Symbol,Mirror>(); 652 Map<Symbol, Mirror> get members => new Map<Symbol,Mirror>();
630 Map<Symbol, MethodMirror> get constructors => new Map<Symbol,MethodMirror>(); 653 Map<Symbol, MethodMirror> get constructors => new Map<Symbol,MethodMirror>();
631 final Map<Symbol, TypeVariableMirror> typeVariables = const {}; 654 final Map<Symbol, TypeVariableMirror> typeVariables = const {};
632 655
633 String toString() => "FunctionTypeMirror on '${_n(simpleName)}'"; 656 String toString() => "FunctionTypeMirror on '${_n(simpleName)}'";
634 657
635 static TypeMirror _FunctionTypeMirror_return_type(reflectee) 658 static Type _FunctionTypeMirror_return_type(reflectee)
636 native "FunctionTypeMirror_return_type"; 659 native "FunctionTypeMirror_return_type";
637 660
638 static List<ParameterMirror> _FunctionTypeMirror_parameters(reflectee) 661 static List<ParameterMirror> _FunctionTypeMirror_parameters(reflectee)
639 native "FunctionTypeMirror_parameters"; 662 native "FunctionTypeMirror_parameters";
640 } 663 }
641 664
642 abstract class _LocalDeclarationMirrorImpl extends _LocalMirrorImpl 665 abstract class _LocalDeclarationMirrorImpl extends _LocalMirrorImpl
643 implements DeclarationMirror { 666 implements DeclarationMirror {
644 _LocalDeclarationMirrorImpl(this._reflectee, this.simpleName); 667 _LocalDeclarationMirrorImpl(this._reflectee, this.simpleName);
645 668
(...skipping 26 matching lines...) Expand all
672 class _LocalTypeVariableMirrorImpl extends _LocalDeclarationMirrorImpl 695 class _LocalTypeVariableMirrorImpl extends _LocalDeclarationMirrorImpl
673 implements TypeVariableMirror { 696 implements TypeVariableMirror {
674 _LocalTypeVariableMirrorImpl(reflectee, 697 _LocalTypeVariableMirrorImpl(reflectee,
675 String simpleName, 698 String simpleName,
676 this._owner) 699 this._owner)
677 : super(reflectee, _s(simpleName)); 700 : super(reflectee, _s(simpleName));
678 701
679 DeclarationMirror _owner; 702 DeclarationMirror _owner;
680 DeclarationMirror get owner { 703 DeclarationMirror get owner {
681 if (_owner == null) { 704 if (_owner == null) {
682 _owner = _LocalTypeVariableMirror_owner(_reflectee); 705 _owner = _TypeVariableMirror_owner(_reflectee);
683 } 706 }
684 return _owner; 707 return _owner;
685 } 708 }
686 709
687 bool get isPrivate => false; 710 bool get isPrivate => false;
688 711
689 final bool isTopLevel = false; 712 final bool isTopLevel = false;
690 713
691 SourceLocation get location { 714 SourceLocation get location {
692 throw new UnimplementedError( 715 throw new UnimplementedError(
693 'TypeVariableMirror.location is not implemented'); 716 'TypeVariableMirror.location is not implemented');
694 } 717 }
695 718
696 TypeMirror _upperBound = null; 719 TypeMirror _upperBound = null;
697 TypeMirror get upperBound { 720 TypeMirror get upperBound {
698 if (_upperBound == null) { 721 if (_upperBound == null) {
699 _upperBound = _LocalTypeVariableMirror_upper_bound(_reflectee); 722 _upperBound =
723 _Mirrors._reflectType(_TypeVariableMirror_upper_bound(_reflectee));
700 } 724 }
701 return _upperBound; 725 return _upperBound;
702 } 726 }
703 727
704 List<InstanceMirror> get metadata { 728 List<InstanceMirror> get metadata {
705 throw new UnimplementedError( 729 throw new UnimplementedError(
706 'TypeVariableMirror.metadata is not implemented'); 730 'TypeVariableMirror.metadata is not implemented');
707 } 731 }
708 732
733 bool get isOriginalDeclaration => true;
734 ClassMirror get originalDeclaration => this;
735
709 String toString() => "TypeVariableMirror on '${_n(simpleName)}'"; 736 String toString() => "TypeVariableMirror on '${_n(simpleName)}'";
710 737
711 static DeclarationMirror _LocalTypeVariableMirror_owner(reflectee) 738 static DeclarationMirror _TypeVariableMirror_owner(reflectee)
712 native "LocalTypeVariableMirror_owner"; 739 native "TypeVariableMirror_owner";
713 740
714 static TypeMirror _LocalTypeVariableMirror_upper_bound(reflectee) 741 static Type _TypeVariableMirror_upper_bound(reflectee)
715 native "LocalTypeVariableMirror_upper_bound"; 742 native "TypeVariableMirror_upper_bound";
716 } 743 }
717 744
718 745
719 class _LocalTypedefMirrorImpl extends _LocalDeclarationMirrorImpl 746 class _LocalTypedefMirrorImpl extends _LocalDeclarationMirrorImpl
720 implements TypedefMirror { 747 implements TypedefMirror {
721 _LocalTypedefMirrorImpl(reflectee, 748 _LocalTypedefMirrorImpl(reflectee,
722 String simpleName, 749 String simpleName,
723 this._owner) 750 this._owner)
724 : super(reflectee, _s(simpleName)); 751 : super(reflectee, _s(simpleName));
725 752
753 // TODO(12282): Deal with generic typedefs.
754 bool get _isGeneric => false;
755
726 DeclarationMirror _owner; 756 DeclarationMirror _owner;
727 DeclarationMirror get owner { 757 DeclarationMirror get owner {
728 if (_owner == null) { 758 if (_owner == null) {
729 _owner = _LocalClassMirrorImpl._library(_reflectee); 759 _owner = _LocalClassMirrorImpl._library(_reflectee);
730 } 760 }
731 return _owner; 761 return _owner;
732 } 762 }
733 763
734 bool get isPrivate => false; 764 bool get isPrivate => false;
735 765
736 final bool isTopLevel = true; 766 final bool isTopLevel = true;
737 767
738 SourceLocation get location { 768 SourceLocation get location {
739 throw new UnimplementedError( 769 throw new UnimplementedError(
740 'TypedefMirror.location is not implemented'); 770 'TypedefMirror.location is not implemented');
741 } 771 }
742 772
743 TypeMirror _referent = null; 773 TypeMirror _referent = null;
744 TypeMirror get referent { 774 TypeMirror get referent {
745 if (_referent == null) { 775 if (_referent == null) {
746 return new _LocalFunctionTypeMirrorImpl( 776 return new _LocalFunctionTypeMirrorImpl(
747 _TypedefMirror_referent(_reflectee)); 777 _TypedefMirror_referent(_reflectee), null /*BOGUS?*/);
regis 2013/08/08 17:06:34 BOGUS? Can you be more specific?
rmacnak 2013/08/08 20:04:06 Replaced with TODO(12282): Deal with generic typed
748 } 778 }
749 return _referent; 779 return _referent;
750 } 780 }
751 781
752 String toString() => "TypedefMirror on '${_n(simpleName)}'"; 782 String toString() => "TypedefMirror on '${_n(simpleName)}'";
753 783
754 static _TypedefMirror_referent(_reflectee) 784 static _TypedefMirror_referent(_reflectee)
755 native "TypedefMirror_referent"; 785 native "TypedefMirror_referent";
756 } 786 }
757 787
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
905 throw new UnimplementedError( 935 throw new UnimplementedError(
906 'MethodMirror.location is not implemented'); 936 'MethodMirror.location is not implemented');
907 } 937 }
908 938
909 TypeMirror _returnType = null; 939 TypeMirror _returnType = null;
910 TypeMirror get returnType { 940 TypeMirror get returnType {
911 if (_returnType == null) { 941 if (_returnType == null) {
912 if (isConstructor) { 942 if (isConstructor) {
913 _returnType = owner; 943 _returnType = owner;
914 } else { 944 } else {
915 _returnType = _MethodMirror_return_type(_reflectee); 945 _returnType =
946 _Mirrors._reflectType(_MethodMirror_return_type(_reflectee));
916 } 947 }
917 } 948 }
918 return _returnType; 949 return _returnType;
919 } 950 }
920 951
921 List<ParameterMirror> _parameters = null; 952 List<ParameterMirror> _parameters = null;
922 List<ParameterMirror> get parameters { 953 List<ParameterMirror> get parameters {
923 if (_parameters == null) { 954 if (_parameters == null) {
924 _parameters = _MethodMirror_parameters(_reflectee); 955 _parameters = _MethodMirror_parameters(_reflectee);
925 } 956 }
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
999 } 1030 }
1000 1031
1001 SourceLocation get location { 1032 SourceLocation get location {
1002 throw new UnimplementedError( 1033 throw new UnimplementedError(
1003 'VariableMirror.location is not implemented'); 1034 'VariableMirror.location is not implemented');
1004 } 1035 }
1005 1036
1006 TypeMirror _type; 1037 TypeMirror _type;
1007 TypeMirror get type { 1038 TypeMirror get type {
1008 if (_type == null) { 1039 if (_type == null) {
1009 _type = _VariableMirror_type(_reflectee); 1040 _type = _Mirrors._reflectType(_VariableMirror_type(_reflectee));
1010 } 1041 }
1011 return _type; 1042 return _type;
1012 } 1043 }
1013 1044
1014 final bool isStatic; 1045 final bool isStatic;
1015 final bool isFinal; 1046 final bool isFinal;
1016 1047
1017 String toString() => "VariableMirror on '${_n(simpleName)}'"; 1048 String toString() => "VariableMirror on '${_n(simpleName)}'";
1018 1049
1019 static _VariableMirror_type(reflectee) 1050 static _VariableMirror_type(reflectee)
(...skipping 23 matching lines...) Expand all
1043 1074
1044 // TODO(11418): Implement. 1075 // TODO(11418): Implement.
1045 List<InstanceMirror> get metadata { 1076 List<InstanceMirror> get metadata {
1046 throw new UnimplementedError( 1077 throw new UnimplementedError(
1047 'ParameterMirror.metadata is not implemented'); 1078 'ParameterMirror.metadata is not implemented');
1048 } 1079 }
1049 1080
1050 TypeMirror _type = null; 1081 TypeMirror _type = null;
1051 TypeMirror get type { 1082 TypeMirror get type {
1052 if (_type == null) { 1083 if (_type == null) {
1053 _type = _ParameterMirror_type(_reflectee, _position); 1084 _type =
1085 _Mirrors._reflectType(_ParameterMirror_type(_reflectee, _position));
1054 } 1086 }
1055 return _type; 1087 return _type;
1056 } 1088 }
1057 1089
1058 static TypeMirror _ParameterMirror_type(_reflectee, _position) 1090 static Type _ParameterMirror_type(_reflectee, _position)
1059 native "ParameterMirror_type"; 1091 native "ParameterMirror_type";
1060 } 1092 }
1061 1093
1062 class _SpecialTypeMirrorImpl extends _LocalMirrorImpl 1094 class _SpecialTypeMirrorImpl extends _LocalMirrorImpl
1063 implements TypeMirror, DeclarationMirror { 1095 implements TypeMirror, DeclarationMirror {
1064 _SpecialTypeMirrorImpl(String name) : simpleName = _s(name); 1096 _SpecialTypeMirrorImpl(String name) : simpleName = _s(name);
1065 1097
1066 final bool isPrivate = false; 1098 final bool isPrivate = false;
1067 final bool isTopLevel = true; 1099 final bool isTopLevel = true;
1068 1100
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
1128 } 1160 }
1129 } 1161 }
1130 1162
1131 // Creates a new local mirror for some Object. 1163 // Creates a new local mirror for some Object.
1132 static InstanceMirror reflect(Object reflectee) { 1164 static InstanceMirror reflect(Object reflectee) {
1133 return reflectee is Function 1165 return reflectee is Function
1134 ? new _LocalClosureMirrorImpl(reflectee) 1166 ? new _LocalClosureMirrorImpl(reflectee)
1135 : new _LocalInstanceMirrorImpl(reflectee); 1167 : new _LocalInstanceMirrorImpl(reflectee);
1136 } 1168 }
1137 1169
1138 // Creates a new local ClassMirror.
1139 static ClassMirror makeLocalClassMirror(Type key) 1170 static ClassMirror makeLocalClassMirror(Type key)
1140 native "Mirrors_makeLocalClassMirror"; 1171 native "Mirrors_makeLocalClassMirror";
1172 static TypeMirror makeLocalTypeMirror(Type key)
1173 native "Mirrors_makeLocalTypeMirror";
1141 1174
1142 static Expando<ClassMirror> _classMirrorCache = new Expando("ClassMirror"); 1175 static Expando<ClassMirror> _declarationCache = new Expando("ClassMirror");
1176 static Expando<ClassMirror> _instanitationCache = new Expando("TypeMirror");
1177
1143 static ClassMirror reflectClass(Type key) { 1178 static ClassMirror reflectClass(Type key) {
1144 var classMirror = _classMirrorCache[key]; 1179 var classMirror = _declarationCache[key];
1145 if (classMirror == null) { 1180 if (classMirror == null) {
1146 classMirror = makeLocalClassMirror(key); 1181 classMirror = makeLocalClassMirror(key);
1147 _classMirrorCache[key] = classMirror; 1182 _declarationCache[key] = classMirror;
1183 if (!classMirror._isGeneric) {
1184 _instanitationCache[key] = classMirror;
1185 }
1148 } 1186 }
1149 return classMirror; 1187 return classMirror;
1150 } 1188 }
1189
1190 static TypeMirror _reflectType(Type key) {
1191 var typeMirror = _instanitationCache[key];
1192 if (typeMirror == null) {
1193 typeMirror = makeLocalTypeMirror(key);
1194 _instanitationCache[key] = typeMirror;
1195 if (typeMirror is ClassMirror && !typeMirror._isGeneric) {
1196 _declarationCache[key] = typeMirror;
1197 }
1198 }
1199 return typeMirror;
1200 }
1151 } 1201 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698