[dart2wasm] Fix accesses to type arguments in sync* functions

Fixes the `Iteration` benchmark.

Change-Id: I947c413524a3d55d19f56d0bfbb45dc5125e972a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/287467
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Ömer Ağacan <omersa@google.com>
This commit is contained in:
Aske Simon Christensen 2023-03-08 17:02:22 +00:00 committed by Commit Queue
parent 9e1c3b4c26
commit 4733f9b754

View file

@ -248,7 +248,14 @@ class SyncStarCodeGenerator extends CodeGenerator {
Context? context = closures.contexts[functionNode];
if (context != null && context.isEmpty) context = context.parent;
generateOuter(functionNode, context, resumeFun);
// Forget about the outer function locals containing the type arguments,
// so accesses to the type arguments in the inner function will fetch them
// from the context.
typeLocals.clear();
generateInner(functionNode, context, resumeFun);
}