File tree 1 file changed +11
-5
lines changed
1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -28224,12 +28224,18 @@ namespace ts {
28224
28224
if (!getContainingClass(privId)) {
28225
28225
return grammarErrorOnNode(privId, Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies);
28226
28226
}
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
+ }
28232
28237
}
28238
+
28233
28239
return false;
28234
28240
}
28235
28241
You can’t perform that action at this time.
0 commit comments