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

Unified Diff: runtime/lib/mirrors_impl.dart

Issue 27610002: Instantations of mixins and interfaces. Equality of type parameters. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: check for resolved typeclass Created 7 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: runtime/lib/mirrors_impl.dart
diff --git a/runtime/lib/mirrors_impl.dart b/runtime/lib/mirrors_impl.dart
index f0d5aa9158ae2a1df04f7478315a9f9bc2d063de..e6208a9e220f288f35565e47f84cabdd03f46c05 100644
--- a/runtime/lib/mirrors_impl.dart
+++ b/runtime/lib/mirrors_impl.dart
@@ -420,18 +420,21 @@ class _LocalClosureMirrorImpl extends _LocalInstanceMirrorImpl
class _LocalClassMirrorImpl extends _LocalObjectMirrorImpl
implements ClassMirror {
_LocalClassMirrorImpl(reflectee,
- this._reflectedType,
+ reflectedType,
String simpleName,
this._isGeneric,
this._isMixinTypedef,
this._isGenericDeclaration)
: this._simpleName = _s(simpleName),
+ this._reflectedType = reflectedType,
+ this._instantiator = reflectedType,
super(reflectee);
final Type _reflectedType;
final bool _isGeneric;
final bool _isMixinTypedef;
final bool _isGenericDeclaration;
+ Type _instantiator;
TypeMirror _instantiateInContextOf(declaration) => this;
@@ -493,6 +496,7 @@ class _LocalClassMirrorImpl extends _LocalObjectMirrorImpl
return null;
}
_trueSuperclassField = _Mirrors._reflectType(supertype);
+ _trueSuperclassField._instantiator = _instantiator;
}
return _trueSuperclassField;
}
@@ -503,7 +507,10 @@ class _LocalClassMirrorImpl extends _LocalObjectMirrorImpl
var _superinterfaces;
List<ClassMirror> get superinterfaces {
if (_superinterfaces == null) {
- _superinterfaces = _interfaces(_reflectee)
+ _superinterfaces = isOriginalDeclaration
+ ? _nativeInterfaces(_reflectedType)
+ : _nativeInterfacesInstantiated(_reflectedType);
+ _superinterfaces = _superinterfaces
.map((i) => _Mirrors._reflectType(i)).toList(growable:false);
}
return _superinterfaces;
@@ -512,7 +519,7 @@ class _LocalClassMirrorImpl extends _LocalObjectMirrorImpl
get _mixinApplicationName {
var mixins = new List<ClassMirror>();
var klass = this;
- while (_computeMixin(klass._reflectee) != null) {
+ while (_nativeMixin(klass._reflectedType) != null) {
mixins.add(klass.mixin);
klass = klass.superclass;
}
@@ -526,9 +533,14 @@ class _LocalClassMirrorImpl extends _LocalObjectMirrorImpl
ClassMirror get mixin {
if (_mixin == null) {
if (_isMixinTypedef) {
- _mixin = _trueSuperclass.mixin;
+ Type mixinType = isOriginalDeclaration
+ ? _nativeMixin(_trueSuperclass._reflectedType)
+ : _nativeMixinInstantiated(_trueSuperclass._reflectedType, _instantiator);
+ _mixin = _Mirrors._reflectType(mixinType);
} else {
- var mixinType = _computeMixin(_reflectee);
+ Type mixinType = isOriginalDeclaration
+ ? _nativeMixin(_reflectedType)
+ : _nativeMixinInstantiated(_reflectedType, _instantiator);
if (mixinType == null) {
// The reflectee is not a mixin application.
_mixin = this;
@@ -709,12 +721,18 @@ class _LocalClassMirrorImpl extends _LocalObjectMirrorImpl
static _supertypeInstantiated(reflectedType)
native "ClassMirror_supertype_instantiated";
- static _interfaces(reflectee)
+ static _nativeInterfaces(reflectedType)
native "ClassMirror_interfaces";
- static _computeMixin(reflectee)
+ static _nativeInterfacesInstantiated(reflectedType)
+ native "ClassMirror_interfaces_instantiated";
+
+ static _nativeMixin(reflectedType)
native "ClassMirror_mixin";
+ static _nativeMixinInstantiated(reflectedType, instantiator)
+ native "ClassMirror_mixin_instantiated";
+
_computeMembers(reflectee)
native "ClassMirror_members";
@@ -745,6 +763,8 @@ class _LocalFunctionTypeMirrorImpl extends _LocalClassMirrorImpl
_LocalFunctionTypeMirrorImpl(reflectee, reflectedType)
: super(reflectee, reflectedType, null, false, false, false);
+ bool get _isAnonymousMixinApplication => false;
+
// FunctionTypeMirrors have a simpleName generated from their signature.
Symbol _simpleName = null;
Symbol get simpleName {
@@ -869,6 +889,13 @@ class _LocalTypeVariableMirrorImpl extends _LocalDeclarationMirrorImpl
String toString() => "TypeVariableMirror on '${_n(simpleName)}'";
+ operator ==(other) {
+ return other is TypeVariableMirror
+ && simpleName == other.simpleName
+ && owner == other.owner;
+ }
+ int get hashCode => simpleName.hashCode;
+
static DeclarationMirror _TypeVariableMirror_owner(reflectee)
native "TypeVariableMirror_owner";

Powered by Google App Engine
This is Rietveld 408576698