Index: runtime/vm/kernel_binary_flowgraph.cc |
diff --git a/runtime/vm/kernel_binary_flowgraph.cc b/runtime/vm/kernel_binary_flowgraph.cc |
index f0b3984379d0af31e41406d3a79417f2e47e7d8b..a9fdd607e3cc2a1342e8c6c7b78004001c729985 100644 |
--- a/runtime/vm/kernel_binary_flowgraph.cc |
+++ b/runtime/vm/kernel_binary_flowgraph.cc |
@@ -6409,8 +6409,6 @@ Fragment StreamingFlowGraphBuilder::BuildClosureCreation( |
instructions += |
StoreInstanceField(TokenPosition::kNoSource, Closure::context_offset()); |
- instructions += Drop(); |
- |
SkipDartType(); // skip function type of the closure. |
// TODO(30455): Kernel generic methods undone. When generic methods are |
@@ -6421,16 +6419,25 @@ Fragment StreamingFlowGraphBuilder::BuildClosureCreation( |
intptr_t types_count = ReadListLength(); // read type count. |
if (types_count > 0) { |
- instructions += LoadLocal(context); |
- |
const TypeArguments& type_args = |
T.BuildTypeArguments(types_count); // read list of type arguments. |
instructions += TranslateInstantiatedTypeArguments(type_args); |
+ LocalVariable* type_args_slot = MakeTemporary(); |
+ instructions += LoadLocal(context); |
+ instructions += LoadLocal(type_args_slot); |
instructions += StoreInstanceField(TokenPosition::kNoSource, |
Context::variable_offset(0)); |
+ |
+ instructions += LoadLocal(closure); |
+ instructions += LoadLocal(type_args_slot); |
+ instructions += StoreInstanceField( |
+ TokenPosition::kNoSource, Closure::function_type_arguments_offset()); |
+ |
+ instructions += Drop(); // type args |
} |
+ instructions += Drop(); // context |
return instructions; |
} |