Chromium Code Reviews| Index: runtime/lib/mirrors_impl.dart |
| =================================================================== |
| --- runtime/lib/mirrors_impl.dart (revision 25060) |
| +++ runtime/lib/mirrors_impl.dart (working copy) |
| @@ -70,8 +70,8 @@ |
| return result; |
| } |
| -List<InstanceMirror> _metadata(mirror) |
|
rmacnak
2013/07/16 21:11:15
This annotation is incorrect. The native answered
|
| - native 'Mirrors_metadata'; |
| +List _metadata(reflectee) |
| + native 'DeclarationMirror_metadata'; |
| // This will verify the argument types, unwrap them, and ensure we have a fixed |
| // array. |
| @@ -171,7 +171,7 @@ |
| abstract class _LocalVMObjectMirrorImpl extends _LocalMirrorImpl { |
| _LocalVMObjectMirrorImpl(this._reference) {} |
| - |
| + |
| // For now, all VMObjects hold a VMReference. We could consider |
| // storing the Object reference itself here if the object is a Dart |
| // language objects (except for objects of type VMReference, of |
| @@ -584,7 +584,7 @@ |
| // get the metadata objects, convert them into InstanceMirrors using |
| // reflect() and then make them into a Dart list |
| - List<InstanceMirror> get metadata => _metadata(this).map(reflect).toList(); |
| + List<InstanceMirror> get metadata => _metadata(_reflectee).map(reflect).toList(); |
| static _name(reflectee) |
| @@ -702,9 +702,10 @@ |
| return _upperBound; |
| } |
| - // get the metadata objects, convert them into InstanceMirrors using |
| - // reflect() and then make them into a Dart list |
| - List<InstanceMirror> get metadata => _metadata(this).map(reflect).toList(); |
| + List<InstanceMirror> get metadata { |
|
rmacnak
2013/07/16 21:11:15
Previously this would always answer an empty list,
|
| + throw new UnimplementedError( |
| + 'TypeVariableMirror.metadata is not implemented'); |
| + } |
| String toString() => "TypeVariableMirror on '${_n(simpleName)}'"; |
| } |
| @@ -848,7 +849,7 @@ |
| // get the metadata objects, convert them into InstanceMirrors using |
| // reflect() and then make them into a Dart list |
| - List<InstanceMirror> get metadata => _metadata(this).map(reflect).toList(); |
| + List<InstanceMirror> get metadata => _metadata(_reflectee).map(reflect).toList(); |
| String toString() => "LibraryMirror on '${_n(simpleName)}'"; |
| @@ -970,7 +971,7 @@ |
| owner; // ensure owner is computed |
| // get the metadata objects, convert them into InstanceMirrors using |
| // reflect() and then make them into a Dart list |
| - return _metadata(this).map(reflect).toList(); |
| + return _metadata(_reflectee).map(reflect).toList(); |
| } |
| String toString() => "MethodMirror on '${_n(simpleName)}'"; |
| @@ -981,13 +982,15 @@ |
| class _LocalVariableMirrorImpl extends _LocalMirrorImpl |
| implements VariableMirror { |
| - _LocalVariableMirrorImpl(String simpleName, |
| + _LocalVariableMirrorImpl(this._reflectee, |
| + String simpleName, |
| this._owner, |
| this._type, |
| this.isStatic, |
| this.isFinal) |
| : this.simpleName = _s(simpleName); |
| + final _MirrorReference _reflectee; |
| final Symbol simpleName; |
| Symbol _qualifiedName = null; |
| @@ -1031,10 +1034,9 @@ |
| final bool isFinal; |
| List<InstanceMirror> get metadata { |
| - owner; // ensure owner is computed |
| // get the metadata objects, convert them into InstanceMirrors using |
| // reflect() and then make them into a Dart list |
| - return _metadata(this).map(reflect).toList(); |
| + return _metadata(_reflectee).map(reflect).toList(); |
| } |
| String toString() => "VariableMirror on '${_n(simpleName)}'"; |
| @@ -1043,7 +1045,7 @@ |
| class _LocalParameterMirrorImpl extends _LocalVariableMirrorImpl |
| implements ParameterMirror { |
| _LocalParameterMirrorImpl(type, this.isOptional) |
| - : super('<TODO:unnamed>', null, type, false, false) {} |
| + : super(null, '<TODO:unnamed>', null, type, false, false) {} |
| final bool isOptional; |
| @@ -1056,6 +1058,12 @@ |
| throw new UnimplementedError( |
| 'ParameterMirror.hasDefaultValue is not implemented'); |
| } |
| + |
| + // TODO(11418): Implement. |
| + List<InstanceMirror> get metadata { |
|
rmacnak
2013/07/16 21:11:15
Previously this raised a fatal, non-meaningful err
|
| + throw new UnimplementedError( |
| + 'ParameterMirror.metadata is not implemented'); |
| + } |
| } |
| class _SpecialTypeMirrorImpl extends _LocalMirrorImpl |