mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-20 05:17:43 -05:00
Fix updateBinary operator parameter (#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`
This commit is contained in:
@@ -1411,10 +1411,11 @@ namespace ts {
|
||||
return node;
|
||||
}
|
||||
|
||||
export function updateBinary(node: BinaryExpression, left: Expression, right: Expression, operator?: BinaryOperator | BinaryOperatorToken) {
|
||||
export function updateBinary(node: BinaryExpression, left: Expression, right: Expression, operator: BinaryOperator | BinaryOperatorToken = node.operatorToken) {
|
||||
return node.left !== left
|
||||
|| node.right !== right
|
||||
? updateNode(createBinary(left, operator || node.operatorToken, right), node)
|
||||
|| node.operatorToken !== operator
|
||||
? updateNode(createBinary(left, operator, right), node)
|
||||
: node;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user