MCPcopy Index your code
hub / github.com/nodejs/node / bindSwitchStatement

Function bindSwitchStatement

test/fixtures/snapshot/typescript.js:45747–45767  ·  view source on GitHub ↗
(node)

Source from the content-addressed store, hash-verified

45745 }
45746 }
45747 function bindSwitchStatement(node) {
45748 var postSwitchLabel = createBranchLabel();
45749 bind(node.expression);
45750 var saveBreakTarget = currentBreakTarget;
45751 var savePreSwitchCaseFlow = preSwitchCaseFlow;
45752 currentBreakTarget = postSwitchLabel;
45753 preSwitchCaseFlow = currentFlow;
45754 bind(node.caseBlock);
45755 addAntecedent(postSwitchLabel, currentFlow);
45756 var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 290 /* SyntaxKind.DefaultClause */; });
45757 // We mark a switch statement as possibly exhaustive if it has no default clause and if all
45758 // case clauses have unreachable end points (e.g. they all return). Note, we no longer need
45759 // this property in control flow analysis, it's there only for backwards compatibility.
45760 node.possiblyExhaustive = !hasDefault && !postSwitchLabel.antecedents;
45761 if (!hasDefault) {
45762 addAntecedent(postSwitchLabel, createFlowSwitchClause(preSwitchCaseFlow, node, 0, 0));
45763 }
45764 currentBreakTarget = saveBreakTarget;
45765 preSwitchCaseFlow = savePreSwitchCaseFlow;
45766 currentFlow = finishFlowLabel(postSwitchLabel);
45767 }
45768 function bindCaseBlock(node) {
45769 var clauses = node.clauses;
45770 var isNarrowingSwitch = isNarrowingExpression(node.parent.expression);

Callers 1

bindChildrenFunction · 0.85

Calls 6

createBranchLabelFunction · 0.85
addAntecedentFunction · 0.85
createFlowSwitchClauseFunction · 0.85
finishFlowLabelFunction · 0.85
bindFunction · 0.70
forEachMethod · 0.65

Tested by

no test coverage detected