Skip to content

Commit 44c6cf7

Browse files
authored
Fix updateBinary operator parameter (microsoft#38129)
* Fix `updateBinary` `operator` parameter There is an issue in `updateBinary` where attempting to update `operator` without updating `left` or `right` results in a silent no-op. * Use defaulted parameter in `updateBinary`
1 parent 94c5c3f commit 44c6cf7

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/compiler/factoryPublic.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1411,10 +1411,11 @@ namespace ts {
14111411
return node;
14121412
}
14131413

1414-
export function updateBinary(node: BinaryExpression, left: Expression, right: Expression, operator?: BinaryOperator | BinaryOperatorToken) {
1414+
export function updateBinary(node: BinaryExpression, left: Expression, right: Expression, operator: BinaryOperator | BinaryOperatorToken = node.operatorToken) {
14151415
return node.left !== left
14161416
|| node.right !== right
1417-
? updateNode(createBinary(left, operator || node.operatorToken, right), node)
1417+
|| node.operatorToken !== operator
1418+
? updateNode(createBinary(left, operator, right), node)
14181419
: node;
14191420
}
14201421

0 commit comments

Comments
 (0)