(node *ast.Node)
| 2217 | } |
| 2218 | |
| 2219 | func (b *Binder) bindBinaryExpressionFlow(node *ast.Node) { |
| 2220 | expr := node.AsBinaryExpression() |
| 2221 | operator := expr.OperatorToken.Kind |
| 2222 | if ast.IsLogicalOrCoalescingBinaryOperator(operator) || ast.IsLogicalOrCoalescingAssignmentOperator(operator) { |
| 2223 | if isTopLevelLogicalExpression(node) { |
| 2224 | postExpressionLabel := b.createBranchLabel() |
| 2225 | saveCurrentFlow := b.currentFlow |
| 2226 | saveHasFlowEffects := b.hasFlowEffects |
| 2227 | b.hasFlowEffects = false |
| 2228 | b.bindLogicalLikeExpression(node, postExpressionLabel, postExpressionLabel) |
| 2229 | if b.hasFlowEffects { |
| 2230 | b.currentFlow = b.finishFlowLabel(postExpressionLabel) |
| 2231 | } else { |
| 2232 | b.currentFlow = saveCurrentFlow |
| 2233 | } |
| 2234 | b.hasFlowEffects = b.hasFlowEffects || saveHasFlowEffects |
| 2235 | } else { |
| 2236 | b.bindLogicalLikeExpression(node, b.currentTrueTarget, b.currentFalseTarget) |
| 2237 | } |
| 2238 | } else { |
| 2239 | b.bind(expr.Left) |
| 2240 | b.bind(expr.Type) |
| 2241 | if operator == ast.KindCommaToken { |
| 2242 | b.maybeBindExpressionFlowIfCall(expr.Left) |
| 2243 | } |
| 2244 | b.bind(expr.OperatorToken) |
| 2245 | b.bind(expr.Right) |
| 2246 | if operator == ast.KindCommaToken { |
| 2247 | b.maybeBindExpressionFlowIfCall(expr.Right) |
| 2248 | } |
| 2249 | if ast.IsAssignmentOperator(operator) && !ast.IsAssignmentTarget(node) { |
| 2250 | b.bindAssignmentTargetFlow(expr.Left) |
| 2251 | if operator == ast.KindEqualsToken && expr.Left.Kind == ast.KindElementAccessExpression { |
| 2252 | elementAccess := expr.Left.AsElementAccessExpression() |
| 2253 | if isNarrowableOperand(elementAccess.Expression) { |
| 2254 | b.currentFlow = b.createFlowMutation(ast.FlowFlagsArrayMutation, b.currentFlow, node) |
| 2255 | } |
| 2256 | } |
| 2257 | } |
| 2258 | } |
| 2259 | } |
| 2260 | |
| 2261 | func (b *Binder) bindLogicalLikeExpression(node *ast.Node, trueTarget *ast.FlowLabel, falseTarget *ast.FlowLabel) { |
| 2262 | expr := node.AsBinaryExpression() |
no test coverage detected