mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-15 04:43:37 -05:00
Bind RHS of comma expressions too (#47049)
This commit is contained in:
@@ -1365,7 +1365,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
function maybeBindExpressionFlowIfCall(node: Expression) {
|
||||
// A top level or LHS of comma expression call expression with a dotted function name and at least one argument
|
||||
// A top level or comma expression call expression with a dotted function name and at least one argument
|
||||
// is potentially an assertion and is therefore included in the control flow.
|
||||
if (node.kind === SyntaxKind.CallExpression) {
|
||||
const call = node as CallExpression;
|
||||
@@ -1550,24 +1550,29 @@ namespace ts {
|
||||
return state;
|
||||
}
|
||||
|
||||
function onLeft(left: Expression, state: WorkArea, _node: BinaryExpression) {
|
||||
function onLeft(left: Expression, state: WorkArea, node: BinaryExpression) {
|
||||
if (!state.skip) {
|
||||
return maybeBind(left);
|
||||
const maybeBound = maybeBind(left);
|
||||
if (node.operatorToken.kind === SyntaxKind.CommaToken) {
|
||||
maybeBindExpressionFlowIfCall(left);
|
||||
}
|
||||
return maybeBound;
|
||||
}
|
||||
}
|
||||
|
||||
function onOperator(operatorToken: BinaryOperatorToken, state: WorkArea, node: BinaryExpression) {
|
||||
function onOperator(operatorToken: BinaryOperatorToken, state: WorkArea, _node: BinaryExpression) {
|
||||
if (!state.skip) {
|
||||
if (operatorToken.kind === SyntaxKind.CommaToken) {
|
||||
maybeBindExpressionFlowIfCall(node.left);
|
||||
}
|
||||
bind(operatorToken);
|
||||
}
|
||||
}
|
||||
|
||||
function onRight(right: Expression, state: WorkArea, _node: BinaryExpression) {
|
||||
function onRight(right: Expression, state: WorkArea, node: BinaryExpression) {
|
||||
if (!state.skip) {
|
||||
return maybeBind(right);
|
||||
const maybeBound = maybeBind(right);
|
||||
if (node.operatorToken.kind === SyntaxKind.CommaToken) {
|
||||
maybeBindExpressionFlowIfCall(right);
|
||||
}
|
||||
return maybeBound;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user