Properly disallow yield in bodyless arrows (#61976)

This commit is contained in:
Mateusz Burzyński
2025-06-30 14:52:49 -07:00
committed by GitHub
parent b70d4d7e4b
commit 1ea1809e16
6 changed files with 77 additions and 0 deletions
+3
View File
@@ -5559,12 +5559,15 @@ namespace Parser {
return parseFunctionBlock(SignatureFlags.IgnoreMissingOpenBrace | (isAsync ? SignatureFlags.Await : SignatureFlags.None));
}
const savedYieldContext = inYieldContext();
setYieldContext(false);
const savedTopLevel = topLevel;
topLevel = false;
const node = isAsync
? doInAwaitContext(() => parseAssignmentExpressionOrHigher(allowReturnTypeInArrowFunction))
: doOutsideOfAwaitContext(() => parseAssignmentExpressionOrHigher(allowReturnTypeInArrowFunction));
topLevel = savedTopLevel;
setYieldContext(savedYieldContext);
return node;
}