Index: runtime/lib/mirrors_impl.dart |
diff --git a/runtime/lib/mirrors_impl.dart b/runtime/lib/mirrors_impl.dart |
index a2ab082698353683625dd7195acd806f3046f56c..d794db09be193aa9fdeec37c9d395b6892ab9f1c 100644 |
--- a/runtime/lib/mirrors_impl.dart |
+++ b/runtime/lib/mirrors_impl.dart |
@@ -1208,15 +1208,17 @@ class _LocalMethodMirrorImpl extends _LocalDeclarationMirrorImpl |
throw new UnimplementedError('MethodMirror.location is not implemented'); |
} |
+ Type get _instantiator => owner is ClassMirror ? owner._reflectedType : null; |
+ |
TypeMirror _returnType = null; |
TypeMirror get returnType { |
if (_returnType == null) { |
if (isConstructor) { |
_returnType = owner; |
regis
2013/11/06 19:06:07
Why don't you instantiate in this case?
|
} else { |
- _returnType = reflectType(_MethodMirror_return_type(_reflectee)); |
+ _returnType = reflectType( |
+ _MethodMirror_return_type(_reflectee, _instantiator)); |
} |
- _returnType = _returnType._instantiateInContextOf(owner); |
} |
return _returnType; |
} |
@@ -1276,7 +1278,7 @@ class _LocalMethodMirrorImpl extends _LocalDeclarationMirrorImpl |
static dynamic _MethodMirror_owner(reflectee) |
native "MethodMirror_owner"; |
- static dynamic _MethodMirror_return_type(reflectee) |
+ static dynamic _MethodMirror_return_type(reflectee, instantiator) |
native "MethodMirror_return_type"; |
List<ParameterMirror> _MethodMirror_parameters(reflectee) |
@@ -1308,18 +1310,19 @@ class _LocalVariableMirrorImpl extends _LocalDeclarationMirrorImpl |
throw new UnimplementedError('VariableMirror.location is not implemented'); |
} |
+ Type get _instantiator => owner is ClassMirror ? owner._reflectedType : null; |
+ |
TypeMirror _type; |
TypeMirror get type { |
if (_type == null) { |
- _type = reflectType(_VariableMirror_type(_reflectee)); |
- _type = _type._instantiateInContextOf(owner); |
+ _type = reflectType(_VariableMirror_type(_reflectee, _instantiator)); |
} |
return _type; |
} |
String toString() => "VariableMirror on '${MirrorSystem.getName(simpleName)}'"; |
- static _VariableMirror_type(reflectee) |
+ static _VariableMirror_type(reflectee, instantiator) |
native "VariableMirror_type"; |
} |
@@ -1361,22 +1364,26 @@ class _LocalParameterMirrorImpl extends _LocalVariableMirrorImpl |
bool get hasDefaultValue => _defaultValueReflectee != null; |
List<InstanceMirror> get metadata { |
- if ( _unmirroredMetadata == null) return emptyList; |
+ if (_unmirroredMetadata == null) return emptyList; |
return new UnmodifiableListView(_unmirroredMetadata.map(reflect)); |
} |
+ Type get _instantiator { |
+ return owner.owner is ClassMirror ? owner.owner._reflectedType : null; |
+ } |
+ |
TypeMirror _type = null; |
TypeMirror get type { |
if (_type == null) { |
- _type = reflectType(_ParameterMirror_type(_reflectee, _position)); |
- _type = _type._instantiateInContextOf(owner); |
+ _type = reflectType( |
+ _ParameterMirror_type(_reflectee, _position, _instantiator)); |
} |
return _type; |
} |
String toString() => "ParameterMirror on '${_n(simpleName)}'"; |
- static Type _ParameterMirror_type(_reflectee, _position) |
+ static Type _ParameterMirror_type(_reflectee, _position, instantiator) |
native "ParameterMirror_type"; |
} |