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

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

Issue 21624006: ParameterMirror: Implement some missing getters. (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 603 matching lines...) Expand 10 before | Expand all | Expand 10 after
614 TypeMirror get returnType { 614 TypeMirror get returnType {
615 if (_returnType == null) { 615 if (_returnType == null) {
616 _returnType = _FunctionTypeMirror_return_type(_reflectee); 616 _returnType = _FunctionTypeMirror_return_type(_reflectee);
617 } 617 }
618 return _returnType; 618 return _returnType;
619 } 619 }
620 620
621 List<ParameterMirror> _parameters = null; 621 List<ParameterMirror> _parameters = null;
622 List<ParameterMirror> get parameters { 622 List<ParameterMirror> get parameters {
623 if (_parameters == null) { 623 if (_parameters == null) {
624 _parameters = _FunctionTypeMirror_parameters(_reflectee); 624 _parameters = _FunctionTypeMirror_parameters(_reflectee, this);
625 } 625 }
626 return _parameters; 626 return _parameters;
627 } 627 }
628 628
629 Map<Symbol, Mirror> get members => new Map<Symbol,Mirror>(); 629 Map<Symbol, Mirror> get members => new Map<Symbol,Mirror>();
630 Map<Symbol, MethodMirror> get constructors => new Map<Symbol,MethodMirror>(); 630 Map<Symbol, MethodMirror> get constructors => new Map<Symbol,MethodMirror>();
631 final Map<Symbol, TypeVariableMirror> typeVariables = const {}; 631 final Map<Symbol, TypeVariableMirror> typeVariables = const {};
632 632
633 String toString() => "FunctionTypeMirror on '${_n(simpleName)}'"; 633 String toString() => "FunctionTypeMirror on '${_n(simpleName)}'";
634 634
635 static TypeMirror _FunctionTypeMirror_return_type(reflectee) 635 static TypeMirror _FunctionTypeMirror_return_type(reflectee)
636 native "FunctionTypeMirror_return_type"; 636 native "FunctionTypeMirror_return_type";
637 637
638 static List<ParameterMirror> _FunctionTypeMirror_parameters(reflectee) 638 static List<ParameterMirror> _FunctionTypeMirror_parameters(reflectee, owner)
639 native "FunctionTypeMirror_parameters"; 639 native "FunctionTypeMirror_parameters";
640 } 640 }
641 641
642 abstract class _LocalDeclarationMirrorImpl extends _LocalMirrorImpl 642 abstract class _LocalDeclarationMirrorImpl extends _LocalMirrorImpl
643 implements DeclarationMirror { 643 implements DeclarationMirror {
644 _LocalDeclarationMirrorImpl(this._reflectee, this.simpleName); 644 _LocalDeclarationMirrorImpl(this._reflectee, this.simpleName);
645 645
646 final _reflectee; 646 final _reflectee;
647 647
648 final Symbol simpleName; 648 final Symbol simpleName;
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
914 } else { 914 } else {
915 _returnType = _MethodMirror_return_type(_reflectee); 915 _returnType = _MethodMirror_return_type(_reflectee);
916 } 916 }
917 } 917 }
918 return _returnType; 918 return _returnType;
919 } 919 }
920 920
921 List<ParameterMirror> _parameters = null; 921 List<ParameterMirror> _parameters = null;
922 List<ParameterMirror> get parameters { 922 List<ParameterMirror> get parameters {
923 if (_parameters == null) { 923 if (_parameters == null) {
924 _parameters = _MethodMirror_parameters(_reflectee); 924 _parameters = _MethodMirror_parameters(_reflectee, this);
925 } 925 }
926 return _parameters; 926 return _parameters;
927 } 927 }
928 928
929 final bool isStatic; 929 final bool isStatic;
930 final bool isAbstract; 930 final bool isAbstract;
931 931
932 bool get isRegularMethod => !isGetter && !isSetter && !isConstructor; 932 bool get isRegularMethod => !isGetter && !isSetter && !isConstructor;
933 933
934 TypeMirror get isOperator { 934 TypeMirror get isOperator {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
967 final bool isFactoryConstructor; 967 final bool isFactoryConstructor;
968 968
969 String toString() => "MethodMirror on '${_n(simpleName)}'"; 969 String toString() => "MethodMirror on '${_n(simpleName)}'";
970 970
971 static dynamic _MethodMirror_owner(reflectee) 971 static dynamic _MethodMirror_owner(reflectee)
972 native "MethodMirror_owner"; 972 native "MethodMirror_owner";
973 973
974 static dynamic _MethodMirror_return_type(reflectee) 974 static dynamic _MethodMirror_return_type(reflectee)
975 native "MethodMirror_return_type"; 975 native "MethodMirror_return_type";
976 976
977 static List<MethodMirror> _MethodMirror_parameters(reflectee) 977 static List<ParameterMirror> _MethodMirror_parameters(reflectee, owner)
978 native "MethodMirror_parameters"; 978 native "MethodMirror_parameters";
979 } 979 }
980 980
981 class _LocalVariableMirrorImpl extends _LocalDeclarationMirrorImpl 981 class _LocalVariableMirrorImpl extends _LocalDeclarationMirrorImpl
982 implements VariableMirror { 982 implements VariableMirror {
983 _LocalVariableMirrorImpl(reflectee, 983 _LocalVariableMirrorImpl(reflectee,
984 String simpleName, 984 String simpleName,
985 this.owner, 985 this.owner,
986 this._type, 986 this._type,
987 this.isStatic, 987 this.isStatic,
(...skipping 27 matching lines...) Expand all
1015 final bool isFinal; 1015 final bool isFinal;
1016 1016
1017 String toString() => "VariableMirror on '${_n(simpleName)}'"; 1017 String toString() => "VariableMirror on '${_n(simpleName)}'";
1018 1018
1019 static _VariableMirror_type(reflectee) 1019 static _VariableMirror_type(reflectee)
1020 native "VariableMirror_type"; 1020 native "VariableMirror_type";
1021 } 1021 }
1022 1022
1023 class _LocalParameterMirrorImpl extends _LocalVariableMirrorImpl 1023 class _LocalParameterMirrorImpl extends _LocalVariableMirrorImpl
1024 implements ParameterMirror { 1024 implements ParameterMirror {
1025 _LocalParameterMirrorImpl(this._reflectee, 1025 _LocalParameterMirrorImpl(reflectee,
1026 String simpleName,
1027 DeclarationMirror owner,
1026 this._position, 1028 this._position,
1027 this.isOptional) 1029 this.isOptional,
1028 : super(null, '<TODO:unnamed>', null, null, false, false); 1030 this.isNamed)
1031 : super(reflectee,
1032 simpleName,
1033 owner,
1034 null, // We override the type.
1035 false, // isStatic does not apply.
1036 false); // TODO(12196): Not yet implemented.
1029 1037
1030 final _MirrorReference _reflectee;
1031 final int _position; 1038 final int _position;
1032 final bool isOptional; 1039 final bool isOptional;
1040 final bool isNamed;
1033 1041
1034 String get defaultValue { 1042 String get defaultValue {
1035 throw new UnimplementedError( 1043 throw new UnimplementedError(
1036 'ParameterMirror.defaultValue is not implemented'); 1044 'ParameterMirror.defaultValue is not implemented');
1037 } 1045 }
1038 1046
1039 bool get hasDefaultValue { 1047 bool get hasDefaultValue {
1040 throw new UnimplementedError( 1048 throw new UnimplementedError(
1041 'ParameterMirror.hasDefaultValue is not implemented'); 1049 'ParameterMirror.hasDefaultValue is not implemented');
1042 } 1050 }
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
1142 static Expando<ClassMirror> _classMirrorCache = new Expando("ClassMirror"); 1150 static Expando<ClassMirror> _classMirrorCache = new Expando("ClassMirror");
1143 static ClassMirror reflectClass(Type key) { 1151 static ClassMirror reflectClass(Type key) {
1144 var classMirror = _classMirrorCache[key]; 1152 var classMirror = _classMirrorCache[key];
1145 if (classMirror == null) { 1153 if (classMirror == null) {
1146 classMirror = makeLocalClassMirror(key); 1154 classMirror = makeLocalClassMirror(key);
1147 _classMirrorCache[key] = classMirror; 1155 _classMirrorCache[key] = classMirror;
1148 } 1156 }
1149 return classMirror; 1157 return classMirror;
1150 } 1158 }
1151 } 1159 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698