Chromium Code Reviews| 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 1071 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1082 native "VariableMirror_type"; | 1082 native "VariableMirror_type"; |
| 1083 } | 1083 } |
| 1084 | 1084 |
| 1085 class _LocalParameterMirrorImpl extends _LocalVariableMirrorImpl | 1085 class _LocalParameterMirrorImpl extends _LocalVariableMirrorImpl |
| 1086 implements ParameterMirror { | 1086 implements ParameterMirror { |
| 1087 _LocalParameterMirrorImpl(reflectee, | 1087 _LocalParameterMirrorImpl(reflectee, |
| 1088 String simpleName, | 1088 String simpleName, |
| 1089 DeclarationMirror owner, | 1089 DeclarationMirror owner, |
| 1090 this._position, | 1090 this._position, |
| 1091 this.isOptional, | 1091 this.isOptional, |
| 1092 this.isNamed) | 1092 this.isNamed, |
| 1093 bool isFinal, | |
| 1094 this._defaultValueReflectee) | |
| 1093 : super(reflectee, | 1095 : super(reflectee, |
| 1094 simpleName, | 1096 simpleName, |
| 1095 owner, | 1097 owner, |
| 1096 null, // We override the type. | 1098 null, // We override the type. |
| 1097 false, // isStatic does not apply. | 1099 false, // isStatic does not apply. |
| 1098 false); // TODO(12196): Not yet implemented. | 1100 isFinal); |
| 1099 | 1101 |
| 1100 final int _position; | 1102 final int _position; |
| 1101 final bool isOptional; | 1103 final bool isOptional; |
| 1102 final bool isNamed; | 1104 final bool isNamed; |
| 1103 | 1105 |
| 1104 String get defaultValue { | 1106 Object _defaultValueReflectee; |
| 1105 throw new UnimplementedError( | 1107 InstanceMirror _defaultValue = null; |
|
ahe
2013/08/27 16:48:38
No need to initialize to null.
Michael Lippautz (Google)
2013/08/27 17:30:15
Done.
| |
| 1106 'ParameterMirror.defaultValue is not implemented'); | 1108 InstanceMirror get defaultValue { |
| 1109 if (!isOptional) { | |
| 1110 return null; | |
| 1111 } | |
| 1112 if (_defaultValue == null) { | |
| 1113 _defaultValue = reflect(_defaultValueReflectee); | |
| 1114 } | |
| 1115 return _defaultValue; | |
| 1107 } | 1116 } |
| 1108 | 1117 |
| 1109 bool get hasDefaultValue { | 1118 bool get hasDefaultValue => _defaultValueReflectee != null; |
| 1110 throw new UnimplementedError( | |
| 1111 'ParameterMirror.hasDefaultValue is not implemented'); | |
| 1112 } | |
| 1113 | 1119 |
| 1114 // TODO(11418): Implement. | 1120 // TODO(11418): Implement. |
| 1115 List<InstanceMirror> get metadata { | 1121 List<InstanceMirror> get metadata { |
| 1116 throw new UnimplementedError( | 1122 throw new UnimplementedError( |
| 1117 'ParameterMirror.metadata is not implemented'); | 1123 'ParameterMirror.metadata is not implemented'); |
| 1118 } | 1124 } |
| 1119 | 1125 |
| 1120 TypeMirror _type = null; | 1126 TypeMirror _type = null; |
| 1121 TypeMirror get type { | 1127 TypeMirror get type { |
| 1122 if (_type == null) { | 1128 if (_type == null) { |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1231 if (typeMirror == null) { | 1237 if (typeMirror == null) { |
| 1232 typeMirror = makeLocalTypeMirror(key); | 1238 typeMirror = makeLocalTypeMirror(key); |
| 1233 _instanitationCache[key] = typeMirror; | 1239 _instanitationCache[key] = typeMirror; |
| 1234 if (typeMirror is ClassMirror && !typeMirror._isGeneric) { | 1240 if (typeMirror is ClassMirror && !typeMirror._isGeneric) { |
| 1235 _declarationCache[key] = typeMirror; | 1241 _declarationCache[key] = typeMirror; |
| 1236 } | 1242 } |
| 1237 } | 1243 } |
| 1238 return typeMirror; | 1244 return typeMirror; |
| 1239 } | 1245 } |
| 1240 } | 1246 } |
| OLD | NEW |