Chromium Code Reviews| Index: runtime/lib/mirrors_impl.dart |
| diff --git a/runtime/lib/mirrors_impl.dart b/runtime/lib/mirrors_impl.dart |
| index ea63f9079e4d381b0ac2b2965447296bc1a3cce4..19c8520665b4359eea5f6100fcd12bd74808ebad 100644 |
| --- a/runtime/lib/mirrors_impl.dart |
| +++ b/runtime/lib/mirrors_impl.dart |
| @@ -1077,27 +1077,30 @@ class _LocalParameterMirrorImpl extends _LocalVariableMirrorImpl |
| DeclarationMirror owner, |
| this._position, |
| this.isOptional, |
| - this.isNamed) |
| + this.isNamed, |
| + bool isFinal, |
| + this._defaultValueReflectee) |
| : super(reflectee, |
| simpleName, |
| owner, |
| null, // We override the type. |
| false, // isStatic does not apply. |
| - false); // TODO(12196): Not yet implemented. |
| + isFinal); |
| final int _position; |
| final bool isOptional; |
| final bool isNamed; |
| - String get defaultValue { |
| - throw new UnimplementedError( |
| - 'ParameterMirror.defaultValue is not implemented'); |
| + Object _defaultValueReflectee; |
| + InstanceMirror _defaultValue = null; |
| + InstanceMirror get defaultValue { |
| + if (_defaultValue == null && isOptional) { |
| + _defaultValue = reflect(_defaultValueReflectee); |
| + } |
|
siva
2013/08/26 05:05:43
Maybe write as:
if (!isOptional) {
return false
Michael Lippautz (Google)
2013/08/26 19:45:57
Rewrote using this pattern, with the difference th
|
| + return _defaultValue; |
| } |
| - bool get hasDefaultValue { |
| - throw new UnimplementedError( |
| - 'ParameterMirror.hasDefaultValue is not implemented'); |
| - } |
| + bool get hasDefaultValue => _defaultValueReflectee != null; |
| // TODO(11418): Implement. |
| List<InstanceMirror> get metadata { |