| Index: runtime/vm/kernel_to_il.cc
|
| diff --git a/runtime/vm/kernel_to_il.cc b/runtime/vm/kernel_to_il.cc
|
| index f28bad745a34d0848626b423151e964d28f9a32b..b7c0c185e31d50d50cb6363824ef173e4907eb39 100644
|
| --- a/runtime/vm/kernel_to_il.cc
|
| +++ b/runtime/vm/kernel_to_il.cc
|
| @@ -3798,6 +3798,18 @@ Fragment FlowGraphBuilder::BuildImplicitClosureCreation(
|
| fragment += AllocateObject(closure_class, target);
|
| LocalVariable* closure = MakeTemporary();
|
|
|
| + // The function signature can have uninstantiated class type parameters.
|
| + //
|
| + // TODO(regis): Also handle the case of a function signature that has
|
| + // uninstantiated function type parameters.
|
| + if (!target.HasInstantiatedSignature(kCurrentClass)) {
|
| + fragment += LoadLocal(closure);
|
| + fragment += LoadInstantiatorTypeArguments();
|
| + fragment +=
|
| + StoreInstanceField(TokenPosition::kNoSource,
|
| + Closure::instantiator_type_arguments_offset());
|
| + }
|
| +
|
| // Allocate a context that closes over `this`.
|
| fragment += AllocateContext(1);
|
| LocalVariable* context = MakeTemporary();
|
| @@ -6697,7 +6709,17 @@ Fragment FlowGraphBuilder::TranslateFunctionNode(FunctionNode* node,
|
| Fragment instructions = AllocateObject(closure_class, function);
|
| LocalVariable* closure = MakeTemporary();
|
|
|
| - // TODO(27590): Generic closures need type arguments.
|
| + // The function signature can have uninstantiated class type parameters.
|
| + //
|
| + // TODO(regis): Also handle the case of a function signature that has
|
| + // uninstantiated function type parameters.
|
| + if (!function.HasInstantiatedSignature(kCurrentClass)) {
|
| + instructions += LoadLocal(closure);
|
| + instructions += LoadInstantiatorTypeArguments();
|
| + instructions +=
|
| + StoreInstanceField(TokenPosition::kNoSource,
|
| + Closure::instantiator_type_arguments_offset());
|
| + }
|
|
|
| // Store the function and the context in the closure.
|
| instructions += LoadLocal(closure);
|
|
|