| 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 // These values are allowed to be passed directly over the wire. | 7 // These values are allowed to be passed directly over the wire. |
| 8 bool _isSimpleValue(var value) { | 8 bool _isSimpleValue(var value) { |
| 9 return (value == null || value is num || value is String || value is bool); | 9 return (value == null || value is num || value is String || value is bool); |
| 10 } | 10 } |
| (...skipping 1033 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1044 } | 1044 } |
| 1045 | 1045 |
| 1046 final bool isStatic; | 1046 final bool isStatic; |
| 1047 final bool isFinal; | 1047 final bool isFinal; |
| 1048 | 1048 |
| 1049 String toString() => "VariableMirror on '${_n(simpleName)}'"; | 1049 String toString() => "VariableMirror on '${_n(simpleName)}'"; |
| 1050 } | 1050 } |
| 1051 | 1051 |
| 1052 class _LocalParameterMirrorImpl extends _LocalVariableMirrorImpl | 1052 class _LocalParameterMirrorImpl extends _LocalVariableMirrorImpl |
| 1053 implements ParameterMirror { | 1053 implements ParameterMirror { |
| 1054 _LocalParameterMirrorImpl(type, this.isOptional) | 1054 _LocalParameterMirrorImpl(this._reflectee, |
| 1055 : super(null, '<TODO:unnamed>', null, type, false, false) {} | 1055 this._position, |
| 1056 this.isOptional) |
| 1057 : super(null, '<TODO:unnamed>', null, null, false, false); |
| 1056 | 1058 |
| 1059 final _MirrorReference _reflectee; |
| 1060 final int _position; |
| 1057 final bool isOptional; | 1061 final bool isOptional; |
| 1058 | 1062 |
| 1059 String get defaultValue { | 1063 String get defaultValue { |
| 1060 throw new UnimplementedError( | 1064 throw new UnimplementedError( |
| 1061 'ParameterMirror.defaultValue is not implemented'); | 1065 'ParameterMirror.defaultValue is not implemented'); |
| 1062 } | 1066 } |
| 1063 | 1067 |
| 1064 bool get hasDefaultValue { | 1068 bool get hasDefaultValue { |
| 1065 throw new UnimplementedError( | 1069 throw new UnimplementedError( |
| 1066 'ParameterMirror.hasDefaultValue is not implemented'); | 1070 'ParameterMirror.hasDefaultValue is not implemented'); |
| 1067 } | 1071 } |
| 1068 | 1072 |
| 1069 // TODO(11418): Implement. | 1073 // TODO(11418): Implement. |
| 1070 List<InstanceMirror> get metadata { | 1074 List<InstanceMirror> get metadata { |
| 1071 throw new UnimplementedError( | 1075 throw new UnimplementedError( |
| 1072 'ParameterMirror.metadata is not implemented'); | 1076 'ParameterMirror.metadata is not implemented'); |
| 1073 } | 1077 } |
| 1078 |
| 1079 TypeMirror _type = null; |
| 1080 TypeMirror get type { |
| 1081 if (_type == null) { |
| 1082 _type = _ParameterMirror_type(_reflectee, _position); |
| 1083 } |
| 1084 return _type; |
| 1085 } |
| 1086 |
| 1087 static TypeMirror _ParameterMirror_type(_reflectee, _position) |
| 1088 native "ParameterMirror_type"; |
| 1074 } | 1089 } |
| 1075 | 1090 |
| 1076 class _SpecialTypeMirrorImpl extends _LocalMirrorImpl | 1091 class _SpecialTypeMirrorImpl extends _LocalMirrorImpl |
| 1077 implements TypeMirror, DeclarationMirror { | 1092 implements TypeMirror, DeclarationMirror { |
| 1078 _SpecialTypeMirrorImpl(String name) : simpleName = _s(name); | 1093 _SpecialTypeMirrorImpl(String name) : simpleName = _s(name); |
| 1079 | 1094 |
| 1080 final bool isPrivate = false; | 1095 final bool isPrivate = false; |
| 1081 final bool isTopLevel = true; | 1096 final bool isTopLevel = true; |
| 1082 | 1097 |
| 1083 // Fixed length 0, therefore immutable. | 1098 // Fixed length 0, therefore immutable. |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1147 static Expando<ClassMirror> _classMirrorCache = new Expando("ClassMirror"); | 1162 static Expando<ClassMirror> _classMirrorCache = new Expando("ClassMirror"); |
| 1148 static ClassMirror reflectClass(Type key) { | 1163 static ClassMirror reflectClass(Type key) { |
| 1149 var classMirror = _classMirrorCache[key]; | 1164 var classMirror = _classMirrorCache[key]; |
| 1150 if (classMirror == null) { | 1165 if (classMirror == null) { |
| 1151 classMirror = makeLocalClassMirror(key); | 1166 classMirror = makeLocalClassMirror(key); |
| 1152 _classMirrorCache[key] = classMirror; | 1167 _classMirrorCache[key] = classMirror; |
| 1153 } | 1168 } |
| 1154 return classMirror; | 1169 return classMirror; |
| 1155 } | 1170 } |
| 1156 } | 1171 } |
| OLD | NEW |