Fix temp variable scoping in async generators (#38121)

This commit is contained in:
Ron Buckton
2020-04-24 12:10:29 -07:00
committed by GitHub
parent 689822c183
commit 38ff7762ec
5 changed files with 85 additions and 1 deletions

View File

@@ -1115,7 +1115,7 @@ namespace ts {
context.requestEmitHelper(asyncGeneratorHelper);
// Mark this node as originally an async function
(generatorFunc.emitNode || (generatorFunc.emitNode = {} as EmitNode)).flags |= EmitFlags.AsyncFunctionBody;
(generatorFunc.emitNode || (generatorFunc.emitNode = {} as EmitNode)).flags |= EmitFlags.AsyncFunctionBody | EmitFlags.ReuseTempVariableScope;
return createCall(
getUnscopedHelperName("__asyncGenerator"),