[vm/mirrors] ClassMirror stop getting methods from mixin class

The problem is that a method from a mixin class was instantiated from a subclass of its mixin application.
Because _instantiator was passed from subclass to its superclass. When getter of declarations are called, it tries to get members from its mixin class. But instantiator were from subclass. This leads to a mismatch in type arguments.

The solution is to compute members from mixin appliation instead of mixin class.

Bug: https://github.com/dart-lang/sdk/issues/37360
Change-Id: Ie23f5c907209a8639cb83b45371a31f0f19cf858
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/113740
Commit-Queue: Zichang Guo <zichangguo@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
This commit is contained in:
Zichang Guo 2019-08-22 17:16:54 +00:00 committed by commit-bot@chromium.org
parent a65615964a
commit 2da2ab7218
2 changed files with 2 additions and 7 deletions

View file

@ -594,10 +594,6 @@ static RawAbstractType* InstantiateType(const AbstractType& type,
AbstractType& result = AbstractType::Handle(type.InstantiateFrom(
instantiator_type_args, Object::null_type_arguments(), kAllFree, NULL,
Heap::kOld));
if (result.IsNull()) {
// TODO(https://github.com/dart-lang/sdk/issues/37360): Remove this.
return type.raw();
}
ASSERT(result.IsFinalized());
return result.Canonicalize();
}

View file

@ -561,8 +561,7 @@ class _LocalClassMirror extends _LocalObjectMirror
var decls = new Map<Symbol, DeclarationMirror>();
var members = (mixin as _LocalClassMirror)._computeMembers(
_instantiator, (mixin as _LocalClassMirror)._reflectee);
var members = _computeMembers(mixin, _instantiator, _reflectee);
for (var member in members) {
decls[member.simpleName] = member;
}
@ -719,7 +718,7 @@ class _LocalClassMirror extends _LocalObjectMirror
static Type _nativeMixinInstantiated(reflectedType, instantiator)
native "ClassMirror_mixin_instantiated";
List<dynamic> _computeMembers(reflectee, instantiator)
static List<dynamic> _computeMembers(owner, reflectee, instantiator)
native "ClassMirror_members";
List<dynamic> _computeConstructors(reflectee, instantiator)