Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃 Pick PR #53665 (Fix crash when private id in array ...) into release-5.0 #53677

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/compiler/transformers/classFields.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2977,11 +2977,11 @@ export function transformClassFields(context: TransformationContext): (x: Source
}

function visitArrayAssignmentElement(node: Expression): Expression {
Debug.assertNode(node, isArrayBindingOrAssignmentElement);
if (isSpreadElement(node)) return visitAssignmentRestElement(node);
if (!isOmittedExpression(node)) return visitAssignmentElement(node);
if (isArrayBindingOrAssignmentElement(node)) {
if (isSpreadElement(node)) return visitAssignmentRestElement(node);
if (!isOmittedExpression(node)) return visitAssignmentElement(node);
}
return visitEachChild(node, visitor, context);

}

function visitAssignmentProperty(node: PropertyAssignment) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
tests/cases/compiler/parserPrivateIdentifierInArrayAssignment.ts(1,2): error TS2364: The left-hand side of an assignment expression must be a variable or a property access.
tests/cases/compiler/parserPrivateIdentifierInArrayAssignment.ts(1,8): error TS1109: Expression expected.


==== tests/cases/compiler/parserPrivateIdentifierInArrayAssignment.ts (2 errors) ====
[#abc]=
~~~~
!!! error TS2364: The left-hand side of an assignment expression must be a variable or a property access.

!!! error TS1109: Expression expected.

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
//// [parserPrivateIdentifierInArrayAssignment.ts]
[#abc]=


//// [parserPrivateIdentifierInArrayAssignment.js]
#abc = [0];
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
=== tests/cases/compiler/parserPrivateIdentifierInArrayAssignment.ts ===

[#abc]=

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
=== tests/cases/compiler/parserPrivateIdentifierInArrayAssignment.ts ===
[#abc]=
>[#abc]= : any
>[#abc] : [any]

> : any

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[#abc]=