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

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

Issue 23224016: Implement ParameterMirror.metadata. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: rebase Created 7 years, 3 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
« no previous file with comments | « runtime/lib/mirrors.cc ('k') | runtime/vm/parser.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1144 matching lines...) Expand 10 before | Expand all | Expand 10 after
1155 1155
1156 class _LocalParameterMirrorImpl extends _LocalVariableMirrorImpl 1156 class _LocalParameterMirrorImpl extends _LocalVariableMirrorImpl
1157 implements ParameterMirror { 1157 implements ParameterMirror {
1158 _LocalParameterMirrorImpl(reflectee, 1158 _LocalParameterMirrorImpl(reflectee,
1159 String simpleName, 1159 String simpleName,
1160 DeclarationMirror owner, 1160 DeclarationMirror owner,
1161 this._position, 1161 this._position,
1162 this.isOptional, 1162 this.isOptional,
1163 this.isNamed, 1163 this.isNamed,
1164 bool isFinal, 1164 bool isFinal,
1165 this._defaultValueReflectee) 1165 this._defaultValueReflectee,
1166 this._unmirroredMetadata)
1166 : super(reflectee, 1167 : super(reflectee,
1167 simpleName, 1168 simpleName,
1168 owner, 1169 owner,
1169 null, // We override the type. 1170 null, // We override the type.
1170 false, // isStatic does not apply. 1171 false, // isStatic does not apply.
1171 isFinal); 1172 isFinal);
1172 1173
1173 final int _position; 1174 final int _position;
1174 final bool isOptional; 1175 final bool isOptional;
1175 final bool isNamed; 1176 final bool isNamed;
1177 final List _unmirroredMetadata;
1176 1178
1177 Object _defaultValueReflectee; 1179 Object _defaultValueReflectee;
1178 InstanceMirror _defaultValue; 1180 InstanceMirror _defaultValue;
1179 InstanceMirror get defaultValue { 1181 InstanceMirror get defaultValue {
1180 if (!isOptional) { 1182 if (!isOptional) {
1181 return null; 1183 return null;
1182 } 1184 }
1183 if (_defaultValue == null) { 1185 if (_defaultValue == null) {
1184 _defaultValue = reflect(_defaultValueReflectee); 1186 _defaultValue = reflect(_defaultValueReflectee);
1185 } 1187 }
1186 return _defaultValue; 1188 return _defaultValue;
1187 } 1189 }
1188 1190
1189 bool get hasDefaultValue => _defaultValueReflectee != null; 1191 bool get hasDefaultValue => _defaultValueReflectee != null;
1190 1192
1191 // TODO(11418): Implement.
1192 List<InstanceMirror> get metadata { 1193 List<InstanceMirror> get metadata {
1193 throw new UnimplementedError( 1194 if ( _unmirroredMetadata == null) return const [];
1194 'ParameterMirror.metadata is not implemented'); 1195 return _unmirroredMetadata.map(reflect).toList(growable:false);
1195 } 1196 }
1196 1197
1197 TypeMirror _type = null; 1198 TypeMirror _type = null;
1198 TypeMirror get type { 1199 TypeMirror get type {
1199 if (_type == null) { 1200 if (_type == null) {
1200 _type = 1201 _type =
1201 _Mirrors._reflectType(_ParameterMirror_type(_reflectee, _position)); 1202 _Mirrors._reflectType(_ParameterMirror_type(_reflectee, _position));
1202 } 1203 }
1203 return _type; 1204 return _type;
1204 } 1205 }
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
1308 if (typeMirror == null) { 1309 if (typeMirror == null) {
1309 typeMirror = makeLocalTypeMirror(key); 1310 typeMirror = makeLocalTypeMirror(key);
1310 _instanitationCache[key] = typeMirror; 1311 _instanitationCache[key] = typeMirror;
1311 if (typeMirror is ClassMirror && !typeMirror._isGeneric) { 1312 if (typeMirror is ClassMirror && !typeMirror._isGeneric) {
1312 _declarationCache[key] = typeMirror; 1313 _declarationCache[key] = typeMirror;
1313 } 1314 }
1314 } 1315 }
1315 return typeMirror; 1316 return typeMirror;
1316 } 1317 }
1317 } 1318 }
OLDNEW
« no previous file with comments | « runtime/lib/mirrors.cc ('k') | runtime/vm/parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698