mirror of
https://github.com/dart-lang/sdk
synced 2024-11-02 08:44:27 +00:00
[dart2js] Fix impliedClasses
logic during RTI resolution.
This code was inadvertently falling through to the `throw` if `VoidType` was encountered (although this case currently never happens). In addition, we were missing cases for some of the newer `DartType`s. This CL fixes those cases and removes Object from the classes implied by `DynamicType`. Change-Id: Ibfecd92c0113d11eb8870d511d60cbc34ac1bfa0 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/159020 Commit-Queue: Mayank Patke <fishythefish@google.com> Reviewed-by: Stephen Adams <sra@google.com>
This commit is contained in:
parent
4c3ae7bca6
commit
1cec77f0a6
1 changed files with 11 additions and 6 deletions
|
@ -1201,18 +1201,23 @@ class RuntimeTypesNeedBuilderImpl implements RuntimeTypesNeedBuilder {
|
||||||
type = type.withoutNullability;
|
type = type.withoutNullability;
|
||||||
if (type is InterfaceType) {
|
if (type is InterfaceType) {
|
||||||
return [type.element];
|
return [type.element];
|
||||||
} else if (type is DynamicType) {
|
} else if (type is NeverType ||
|
||||||
return [commonElements.objectClass];
|
type is DynamicType ||
|
||||||
|
type is VoidType ||
|
||||||
|
type is AnyType ||
|
||||||
|
type is ErasedType) {
|
||||||
|
// No classes implied.
|
||||||
|
return const [];
|
||||||
} else if (type is FunctionType) {
|
} else if (type is FunctionType) {
|
||||||
// TODO(johnniwinther): Include only potential function type subtypes.
|
// TODO(johnniwinther): Include only potential function type subtypes.
|
||||||
return [commonElements.functionClass];
|
return [commonElements.functionClass];
|
||||||
} else if (type is VoidType) {
|
|
||||||
// No classes implied.
|
|
||||||
} else if (type is FunctionTypeVariable) {
|
} else if (type is FunctionTypeVariable) {
|
||||||
return impliedClasses(type.bound);
|
return impliedClasses(type.bound);
|
||||||
} else if (type is FutureOrType) {
|
} else if (type is FutureOrType) {
|
||||||
return [commonElements.futureClass]
|
return [
|
||||||
..addAll(impliedClasses(type.typeArgument));
|
commonElements.futureClass,
|
||||||
|
...impliedClasses(type.typeArgument),
|
||||||
|
];
|
||||||
} else if (type is TypeVariableType) {
|
} else if (type is TypeVariableType) {
|
||||||
// TODO(johnniwinther): Can we do better?
|
// TODO(johnniwinther): Can we do better?
|
||||||
return impliedClasses(
|
return impliedClasses(
|
||||||
|
|
Loading…
Reference in a new issue