@@ -8424,12 +8424,12 @@ namespace ts {
8424
8424
return node;
8425
8425
}
8426
8426
8427
- function getReferenceParent (node: Node): Node {
8427
+ function getReferenceRoot (node: Node): Node {
8428
8428
const parent = node.parent;
8429
8429
return parent.kind === SyntaxKind.ParenthesizedExpression ||
8430
8430
parent.kind === SyntaxKind.BinaryExpression && (<BinaryExpression>parent).operatorToken.kind === SyntaxKind.EqualsToken && (<BinaryExpression>parent).left === node ||
8431
8431
parent.kind === SyntaxKind.BinaryExpression && (<BinaryExpression>parent).operatorToken.kind === SyntaxKind.CommaToken && (<BinaryExpression>parent).right === node ?
8432
- getReferenceParent (parent) : parent ;
8432
+ getReferenceRoot (parent) : node ;
8433
8433
}
8434
8434
8435
8435
function getTypeOfSwitchClause(clause: CaseClause | DefaultClause) {
@@ -8564,7 +8564,7 @@ namespace ts {
8564
8564
8565
8565
// Return true if the given node is 'x' in an 'x.push(value)' operation.
8566
8566
function isPushCallTarget(node: Node) {
8567
- const parent = getReferenceParent (node);
8567
+ const parent = getReferenceRoot (node).parent ;
8568
8568
return parent.kind === SyntaxKind.PropertyAccessExpression &&
8569
8569
(<PropertyAccessExpression>parent).name.text === "push" &&
8570
8570
parent.parent.kind === SyntaxKind.CallExpression;
@@ -8573,9 +8573,10 @@ namespace ts {
8573
8573
// Return true if the given node is 'x' in an 'x[n] = value' operation, where 'n' is an
8574
8574
// expression of type any, undefined, or a number-like type.
8575
8575
function isElementAssignmentTarget(node: Node) {
8576
- const parent = getReferenceParent(node);
8576
+ const root = getReferenceRoot(node);
8577
+ const parent = root.parent;
8577
8578
return parent.kind === SyntaxKind.ElementAccessExpression &&
8578
- (<ElementAccessExpression>parent).expression === node &&
8579
+ (<ElementAccessExpression>parent).expression === root &&
8579
8580
parent.parent.kind === SyntaxKind.BinaryExpression &&
8580
8581
(<BinaryExpression>parent.parent).operatorToken.kind === SyntaxKind.EqualsToken &&
8581
8582
(<BinaryExpression>parent.parent).left === parent &&
0 commit comments