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

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

Issue 23065007: Implement ParameterMirror.{isFinal,hasDefaultValue,defaultValue}. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 4 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 1052 matching lines...) Expand 10 before | Expand all | Expand 10 after
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(reflectee, 1068 _LocalParameterMirrorImpl(reflectee,
1069 String simpleName, 1069 String simpleName,
1070 DeclarationMirror owner, 1070 DeclarationMirror owner,
1071 this._position, 1071 this._position,
1072 this.isOptional, 1072 this.isOptional,
1073 this.isNamed) 1073 this.isNamed,
1074 bool isFinal,
1075 this._defaultValueReflectee)
1074 : super(reflectee, 1076 : super(reflectee,
1075 simpleName, 1077 simpleName,
1076 owner, 1078 owner,
1077 null, // We override the type. 1079 null, // We override the type.
1078 false, // isStatic does not apply. 1080 false, // isStatic does not apply.
1079 false); // TODO(12196): Not yet implemented. 1081 isFinal);
1080 1082
1081 final int _position; 1083 final int _position;
1082 final bool isOptional; 1084 final bool isOptional;
1083 final bool isNamed; 1085 final bool isNamed;
1084 1086
1085 String get defaultValue { 1087 Object _defaultValueReflectee;
1086 throw new UnimplementedError( 1088 InstanceMirror _defaultValue = null;
1087 'ParameterMirror.defaultValue is not implemented'); 1089 InstanceMirror get defaultValue {
1090 if (_defaultValue == null && hasDefaultValue) {
1091 _defaultValue = reflect(_defaultValueReflectee);
1092 }
1093 return _defaultValue;
1088 } 1094 }
1089 1095
1090 bool get hasDefaultValue { 1096 bool get hasDefaultValue => !(_defaultValueReflectee == null);
1091 throw new UnimplementedError(
1092 'ParameterMirror.hasDefaultValue is not implemented');
1093 }
1094 1097
1095 // TODO(11418): Implement. 1098 // TODO(11418): Implement.
1096 List<InstanceMirror> get metadata { 1099 List<InstanceMirror> get metadata {
1097 throw new UnimplementedError( 1100 throw new UnimplementedError(
1098 'ParameterMirror.metadata is not implemented'); 1101 'ParameterMirror.metadata is not implemented');
1099 } 1102 }
1100 1103
1101 TypeMirror _type = null; 1104 TypeMirror _type = null;
1102 TypeMirror get type { 1105 TypeMirror get type {
1103 if (_type == null) { 1106 if (_type == null) {
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
1212 if (typeMirror == null) { 1215 if (typeMirror == null) {
1213 typeMirror = makeLocalTypeMirror(key); 1216 typeMirror = makeLocalTypeMirror(key);
1214 _instanitationCache[key] = typeMirror; 1217 _instanitationCache[key] = typeMirror;
1215 if (typeMirror is ClassMirror && !typeMirror._isGeneric) { 1218 if (typeMirror is ClassMirror && !typeMirror._isGeneric) {
1216 _declarationCache[key] = typeMirror; 1219 _declarationCache[key] = typeMirror;
1217 } 1220 }
1218 } 1221 }
1219 return typeMirror; 1222 return typeMirror;
1220 } 1223 }
1221 } 1224 }
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