| OLD | NEW |
| 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 651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 662 final Map<Symbol, TypeVariableMirror> typeVariables = const {}; | 662 final Map<Symbol, TypeVariableMirror> typeVariables = const {}; |
| 663 | 663 |
| 664 String toString() => "FunctionTypeMirror on '${_n(simpleName)}'"; | 664 String toString() => "FunctionTypeMirror on '${_n(simpleName)}'"; |
| 665 | 665 |
| 666 MethodMirror _FunctionTypeMirror_call_method(reflectee) | 666 MethodMirror _FunctionTypeMirror_call_method(reflectee) |
| 667 native "FunctionTypeMirror_call_method"; | 667 native "FunctionTypeMirror_call_method"; |
| 668 | 668 |
| 669 static Type _FunctionTypeMirror_return_type(reflectee) | 669 static Type _FunctionTypeMirror_return_type(reflectee) |
| 670 native "FunctionTypeMirror_return_type"; | 670 native "FunctionTypeMirror_return_type"; |
| 671 | 671 |
| 672 static List<ParameterMirror> _FunctionTypeMirror_parameters(reflectee) | 672 List<ParameterMirror> _FunctionTypeMirror_parameters(reflectee) |
| 673 native "FunctionTypeMirror_parameters"; | 673 native "FunctionTypeMirror_parameters"; |
| 674 } | 674 } |
| 675 | 675 |
| 676 abstract class _LocalDeclarationMirrorImpl extends _LocalMirrorImpl | 676 abstract class _LocalDeclarationMirrorImpl extends _LocalMirrorImpl |
| 677 implements DeclarationMirror { | 677 implements DeclarationMirror { |
| 678 _LocalDeclarationMirrorImpl(this._reflectee, this.simpleName); | 678 _LocalDeclarationMirrorImpl(this._reflectee, this.simpleName); |
| 679 | 679 |
| 680 final _reflectee; | 680 final _reflectee; |
| 681 | 681 |
| 682 final Symbol simpleName; | 682 final Symbol simpleName; |
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1010 final bool isFactoryConstructor; | 1010 final bool isFactoryConstructor; |
| 1011 | 1011 |
| 1012 String toString() => "MethodMirror on '${_n(simpleName)}'"; | 1012 String toString() => "MethodMirror on '${_n(simpleName)}'"; |
| 1013 | 1013 |
| 1014 static dynamic _MethodMirror_owner(reflectee) | 1014 static dynamic _MethodMirror_owner(reflectee) |
| 1015 native "MethodMirror_owner"; | 1015 native "MethodMirror_owner"; |
| 1016 | 1016 |
| 1017 static dynamic _MethodMirror_return_type(reflectee) | 1017 static dynamic _MethodMirror_return_type(reflectee) |
| 1018 native "MethodMirror_return_type"; | 1018 native "MethodMirror_return_type"; |
| 1019 | 1019 |
| 1020 static List<MethodMirror> _MethodMirror_parameters(reflectee) | 1020 List<ParameterMirror> _MethodMirror_parameters(reflectee) |
| 1021 native "MethodMirror_parameters"; | 1021 native "MethodMirror_parameters"; |
| 1022 } | 1022 } |
| 1023 | 1023 |
| 1024 class _LocalVariableMirrorImpl extends _LocalDeclarationMirrorImpl | 1024 class _LocalVariableMirrorImpl extends _LocalDeclarationMirrorImpl |
| 1025 implements VariableMirror { | 1025 implements VariableMirror { |
| 1026 _LocalVariableMirrorImpl(reflectee, | 1026 _LocalVariableMirrorImpl(reflectee, |
| 1027 String simpleName, | 1027 String simpleName, |
| 1028 this.owner, | 1028 this.owner, |
| 1029 this._type, | 1029 this._type, |
| 1030 this.isStatic, | 1030 this.isStatic, |
| (...skipping 27 matching lines...) Expand all Loading... |
| 1058 final bool isFinal; | 1058 final bool isFinal; |
| 1059 | 1059 |
| 1060 String toString() => "VariableMirror on '${_n(simpleName)}'"; | 1060 String toString() => "VariableMirror on '${_n(simpleName)}'"; |
| 1061 | 1061 |
| 1062 static _VariableMirror_type(reflectee) | 1062 static _VariableMirror_type(reflectee) |
| 1063 native "VariableMirror_type"; | 1063 native "VariableMirror_type"; |
| 1064 } | 1064 } |
| 1065 | 1065 |
| 1066 class _LocalParameterMirrorImpl extends _LocalVariableMirrorImpl | 1066 class _LocalParameterMirrorImpl extends _LocalVariableMirrorImpl |
| 1067 implements ParameterMirror { | 1067 implements ParameterMirror { |
| 1068 _LocalParameterMirrorImpl(this._reflectee, | 1068 _LocalParameterMirrorImpl(reflectee, |
| 1069 String simpleName, |
| 1070 DeclarationMirror owner, |
| 1069 this._position, | 1071 this._position, |
| 1070 this.isOptional) | 1072 this.isOptional, |
| 1071 : super(null, '<TODO:unnamed>', null, null, false, false); | 1073 this.isNamed) |
| 1074 : super(reflectee, |
| 1075 simpleName, |
| 1076 owner, |
| 1077 null, // We override the type. |
| 1078 false, // isStatic does not apply. |
| 1079 false); // TODO(12196): Not yet implemented. |
| 1072 | 1080 |
| 1073 final _MirrorReference _reflectee; | |
| 1074 final int _position; | 1081 final int _position; |
| 1075 final bool isOptional; | 1082 final bool isOptional; |
| 1083 final bool isNamed; |
| 1076 | 1084 |
| 1077 String get defaultValue { | 1085 String get defaultValue { |
| 1078 throw new UnimplementedError( | 1086 throw new UnimplementedError( |
| 1079 'ParameterMirror.defaultValue is not implemented'); | 1087 'ParameterMirror.defaultValue is not implemented'); |
| 1080 } | 1088 } |
| 1081 | 1089 |
| 1082 bool get hasDefaultValue { | 1090 bool get hasDefaultValue { |
| 1083 throw new UnimplementedError( | 1091 throw new UnimplementedError( |
| 1084 'ParameterMirror.hasDefaultValue is not implemented'); | 1092 'ParameterMirror.hasDefaultValue is not implemented'); |
| 1085 } | 1093 } |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1204 if (typeMirror == null) { | 1212 if (typeMirror == null) { |
| 1205 typeMirror = makeLocalTypeMirror(key); | 1213 typeMirror = makeLocalTypeMirror(key); |
| 1206 _instanitationCache[key] = typeMirror; | 1214 _instanitationCache[key] = typeMirror; |
| 1207 if (typeMirror is ClassMirror && !typeMirror._isGeneric) { | 1215 if (typeMirror is ClassMirror && !typeMirror._isGeneric) { |
| 1208 _declarationCache[key] = typeMirror; | 1216 _declarationCache[key] = typeMirror; |
| 1209 } | 1217 } |
| 1210 } | 1218 } |
| 1211 return typeMirror; | 1219 return typeMirror; |
| 1212 } | 1220 } |
| 1213 } | 1221 } |
| OLD | NEW |