File tree Expand file tree Collapse file tree 1 file changed +11
-5
lines changed
Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -28224,12 +28224,18 @@ namespace ts {
2822428224 if (!getContainingClass(privId)) {
2822528225 return grammarErrorOnNode(privId, Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies);
2822628226 }
28227- if (!isExpressionNode(privId)) {
28228- return grammarErrorOnNode(privId, Diagnostics.Private_identifiers_are_only_allowed_in_class_bodies_and_may_only_be_used_as_part_of_a_class_member_declaration_property_access_or_on_the_left_hand_side_of_an_in_expression);
28229- }
28230- if (!getSymbolForPrivateIdentifierExpression(privId)) {
28231- return grammarErrorOnNode(privId, Diagnostics.Cannot_find_name_0, idText(privId));
28227+
28228+ if (!isForInStatement(privId.parent)) {
28229+ if (!isExpressionNode(privId)) {
28230+ return grammarErrorOnNode(privId, Diagnostics.Private_identifiers_are_only_allowed_in_class_bodies_and_may_only_be_used_as_part_of_a_class_member_declaration_property_access_or_on_the_left_hand_side_of_an_in_expression);
28231+ }
28232+
28233+ const isInOperation = isBinaryExpression(privId.parent) && privId.parent.operatorToken.kind === SyntaxKind.InKeyword;
28234+ if (!getSymbolForPrivateIdentifierExpression(privId) && !isInOperation) {
28235+ return grammarErrorOnNode(privId, Diagnostics.Cannot_find_name_0, idText(privId));
28236+ }
2823228237 }
28238+
2823328239 return false;
2823428240 }
2823528241
You can’t perform that action at this time.
0 commit comments