mirror of
https://github.com/dart-lang/sdk
synced 2024-09-05 00:13:50 +00:00
[dart2wasm] Fix bug in algorithm to reuse super _typeArguments
.
language/type_variable/promotion_test starts failing because `joinReplaceAllResult` isn't implemented yet. Change-Id: Ifd7ff6d94486499b8cf398dd2c749d10500e242a Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250480 Commit-Queue: Joshua Litt <joshualitt@google.com> Reviewed-by: Aske Simon Christensen <askesc@google.com>
This commit is contained in:
parent
f8ac4a19b3
commit
2c891cda56
|
@ -51,10 +51,25 @@ class _WasmTransformer extends Transformer {
|
|||
return result;
|
||||
}
|
||||
|
||||
/// We can reuse a superclass' `_typeArguments` method if the subclass and the
|
||||
/// superclass have the exact same type parameters in the exact same order.
|
||||
/// Checks to see if it is safe to reuse `super._typeArguments`.
|
||||
bool canReuseSuperMethod(Class cls) {
|
||||
Supertype supertype = cls.supertype!;
|
||||
// We search for the first non-abstract super in [cls]'s inheritance chain
|
||||
// to see if we can reuse its `_typeArguments` method.
|
||||
Class classIter = cls;
|
||||
late Supertype supertype;
|
||||
while (classIter.supertype != null) {
|
||||
Supertype supertypeIter = classIter.supertype!;
|
||||
Class superclass = supertypeIter.classNode;
|
||||
if (!superclass.isAbstract) {
|
||||
supertype = supertypeIter;
|
||||
break;
|
||||
}
|
||||
classIter = classIter.supertype!.classNode;
|
||||
}
|
||||
|
||||
// We can reuse a superclass' `_typeArguments` method if the subclass and
|
||||
// the superclass have the exact same type parameters in the exact same
|
||||
// order.
|
||||
if (cls.typeParameters.length != supertype.typeArguments.length) {
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue