| Index: pkg/kernel/lib/transformations/reify/transformation/remove_generics.dart
|
| diff --git a/pkg/kernel/lib/transformations/reify/transformation/remove_generics.dart b/pkg/kernel/lib/transformations/reify/transformation/remove_generics.dart
|
| index aafff7d93c0c32c3fd6b2aa98d2da4c21a17b80b..1a103f6abe97f365d22443d63bb31131350e6696 100644
|
| --- a/pkg/kernel/lib/transformations/reify/transformation/remove_generics.dart
|
| +++ b/pkg/kernel/lib/transformations/reify/transformation/remove_generics.dart
|
| @@ -27,12 +27,24 @@ class Erasure extends Transformer with DartTypeVisitor<DartType> {
|
| }
|
|
|
| TreeNode removeTypeArgumentsOfStaticCall(StaticInvocation node) {
|
| - Class cls = node.target.parent;
|
| - if (removeTypeParameters(cls)) {
|
| - node.arguments.types.clear();
|
| - Procedure target = node.target;
|
| - target.function.typeParameters.clear();
|
| + if (node.target.parent is Class) {
|
| + Class cls = node.target.parent;
|
| + if (!removeTypeParameters(cls)) {
|
| + return node;
|
| + }
|
| + } else {
|
| + // If parent is a Library, then a global procedure is invoked, and it may
|
| + // be a generic function, so we need to remove type arguments anyway.
|
| + assert(node.target.parent is Library);
|
| }
|
| + node.arguments.types.clear();
|
| + Procedure target = node.target;
|
| + target.function.typeParameters.clear();
|
| + return node;
|
| + }
|
| +
|
| + TreeNode removeTypeArgumentOfMethodInvocation(MethodInvocation node) {
|
| + node.arguments.types.clear();
|
| return node;
|
| }
|
|
|
| @@ -96,7 +108,8 @@ class Erasure extends Transformer with DartTypeVisitor<DartType> {
|
| @override
|
| StaticInvocation visitStaticInvocation(StaticInvocation node) {
|
| node.transformChildren(this);
|
| - if (node.target.kind == ProcedureKind.Factory) {
|
| + if (node.target.kind == ProcedureKind.Factory ||
|
| + node.target.kind == ProcedureKind.Method) {
|
| node = removeTypeArgumentsOfStaticCall(node);
|
| }
|
| return node;
|
| @@ -116,4 +129,10 @@ class Erasure extends Transformer with DartTypeVisitor<DartType> {
|
| }
|
| return node;
|
| }
|
| +
|
| + @override
|
| + Expression visitMethodInvocation(MethodInvocation node) {
|
| + node.transformChildren(this);
|
| + return removeTypeArgumentOfMethodInvocation(node);
|
| + }
|
| }
|
|
|