| 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 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 List<ParameterMirror> _FunctionTypeMirror_parameters(reflectee) |
| 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 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 List<ParameterMirror> _MethodMirror_parameters(reflectee) |
| 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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |