MCPcopy Create free account
hub / github.com/microsoft/typescript-go / bindConditionalExpressionFlow

Method bindConditionalExpressionFlow

internal/binder/binder.go:2289–2312  ·  view source on GitHub ↗
(node *ast.Node)

Source from the content-addressed store, hash-verified

2287}
2288
2289func (b *Binder) bindConditionalExpressionFlow(node *ast.Node) {
2290 expr := node.AsConditionalExpression()
2291 trueLabel := b.createBranchLabel()
2292 falseLabel := b.createBranchLabel()
2293 postExpressionLabel := b.createBranchLabel()
2294 saveCurrentFlow := b.currentFlow
2295 saveHasFlowEffects := b.hasFlowEffects
2296 b.hasFlowEffects = false
2297 b.bindCondition(expr.Condition, trueLabel, falseLabel)
2298 b.currentFlow = b.finishFlowLabel(trueLabel)
2299 b.bind(expr.QuestionToken)
2300 b.bind(expr.WhenTrue)
2301 b.addAntecedent(postExpressionLabel, b.currentFlow)
2302 b.currentFlow = b.finishFlowLabel(falseLabel)
2303 b.bind(expr.ColonToken)
2304 b.bind(expr.WhenFalse)
2305 b.addAntecedent(postExpressionLabel, b.currentFlow)
2306 if b.hasFlowEffects {
2307 b.currentFlow = b.finishFlowLabel(postExpressionLabel)
2308 } else {
2309 b.currentFlow = saveCurrentFlow
2310 }
2311 b.hasFlowEffects = b.hasFlowEffects || saveHasFlowEffects
2312}
2313
2314func (b *Binder) bindVariableDeclarationFlow(node *ast.Node) {
2315 b.bindEachChild(node)

Callers 1

bindChildrenMethod · 0.95

Calls 6

createBranchLabelMethod · 0.95
bindConditionMethod · 0.95
finishFlowLabelMethod · 0.95
bindMethod · 0.95
addAntecedentMethod · 0.95

Tested by

no test coverage detected