mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-23 07:07:09 -05:00
fix(43879): forbid async in the left hand in a for-of statement (#43886)
This commit is contained in:
@@ -41471,6 +41471,12 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
if (isForOfStatement(forInOrOfStatement) && !(forInOrOfStatement.flags & NodeFlags.AwaitContext) &&
|
||||
isIdentifier(forInOrOfStatement.initializer) && forInOrOfStatement.initializer.escapedText === "async") {
|
||||
grammarErrorOnNode(forInOrOfStatement.initializer, Diagnostics.The_left_hand_side_of_a_for_of_statement_may_not_be_async);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (forInOrOfStatement.initializer.kind === SyntaxKind.VariableDeclarationList) {
|
||||
const variableList = <VariableDeclarationList>forInOrOfStatement.initializer;
|
||||
if (!checkGrammarVariableDeclarationList(variableList)) {
|
||||
|
||||
@@ -319,6 +319,10 @@
|
||||
"category": "Error",
|
||||
"code": 1105
|
||||
},
|
||||
"The left-hand side of a 'for...of' statement may not be 'async'.": {
|
||||
"category": "Error",
|
||||
"code": 1106
|
||||
},
|
||||
"Jump target cannot cross function boundary.": {
|
||||
"category": "Error",
|
||||
"code": 1107
|
||||
|
||||
Reference in New Issue
Block a user