Skip to content

Commit 612ed1e

Browse files
committed
Fix minor issue
1 parent e6b588a commit 612ed1e

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/compiler/checker.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8424,12 +8424,12 @@ namespace ts {
84248424
return node;
84258425
}
84268426

8427-
function getReferenceParent(node: Node): Node {
8427+
function getReferenceRoot(node: Node): Node {
84288428
const parent = node.parent;
84298429
return parent.kind === SyntaxKind.ParenthesizedExpression ||
84308430
parent.kind === SyntaxKind.BinaryExpression && (<BinaryExpression>parent).operatorToken.kind === SyntaxKind.EqualsToken && (<BinaryExpression>parent).left === node ||
84318431
parent.kind === SyntaxKind.BinaryExpression && (<BinaryExpression>parent).operatorToken.kind === SyntaxKind.CommaToken && (<BinaryExpression>parent).right === node ?
8432-
getReferenceParent(parent) : parent;
8432+
getReferenceRoot(parent) : node;
84338433
}
84348434

84358435
function getTypeOfSwitchClause(clause: CaseClause | DefaultClause) {
@@ -8564,7 +8564,7 @@ namespace ts {
85648564

85658565
// Return true if the given node is 'x' in an 'x.push(value)' operation.
85668566
function isPushCallTarget(node: Node) {
8567-
const parent = getReferenceParent(node);
8567+
const parent = getReferenceRoot(node).parent;
85688568
return parent.kind === SyntaxKind.PropertyAccessExpression &&
85698569
(<PropertyAccessExpression>parent).name.text === "push" &&
85708570
parent.parent.kind === SyntaxKind.CallExpression;
@@ -8573,9 +8573,10 @@ namespace ts {
85738573
// Return true if the given node is 'x' in an 'x[n] = value' operation, where 'n' is an
85748574
// expression of type any, undefined, or a number-like type.
85758575
function isElementAssignmentTarget(node: Node) {
8576-
const parent = getReferenceParent(node);
8576+
const root = getReferenceRoot(node);
8577+
const parent = root.parent;
85778578
return parent.kind === SyntaxKind.ElementAccessExpression &&
8578-
(<ElementAccessExpression>parent).expression === node &&
8579+
(<ElementAccessExpression>parent).expression === root &&
85798580
parent.parent.kind === SyntaxKind.BinaryExpression &&
85808581
(<BinaryExpression>parent.parent).operatorToken.kind === SyntaxKind.EqualsToken &&
85818582
(<BinaryExpression>parent.parent).left === parent &&

0 commit comments

Comments
 (0)