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

Function createFlowCondition

test/fixtures/snapshot/typescript.js:45444–45461  ·  view source on GitHub ↗
(flags, antecedent, expression)

Source from the content-addressed store, hash-verified

45442 }
45443 }
45444 function createFlowCondition(flags, antecedent, expression) {
45445 if (antecedent.flags & 1 /* FlowFlags.Unreachable */) {
45446 return antecedent;
45447 }
45448 if (!expression) {
45449 return flags & 32 /* FlowFlags.TrueCondition */ ? antecedent : unreachableFlow;
45450 }
45451 if ((expression.kind === 110 /* SyntaxKind.TrueKeyword */ && flags & 64 /* FlowFlags.FalseCondition */ ||
45452 expression.kind === 95 /* SyntaxKind.FalseKeyword */ && flags & 32 /* FlowFlags.TrueCondition */) &&
45453 !ts.isExpressionOfOptionalChainRoot(expression) && !ts.isNullishCoalesce(expression.parent)) {
45454 return unreachableFlow;
45455 }
45456 if (!isNarrowingExpression(expression)) {
45457 return antecedent;
45458 }
45459 setFlowNodeReferenced(antecedent);
45460 return initFlowNode({ flags: flags, antecedent: antecedent, node: expression });
45461 }
45462 function createFlowSwitchClause(antecedent, switchStatement, clauseStart, clauseEnd) {
45463 setFlowNodeReferenced(antecedent);
45464 return initFlowNode({ flags: 128 /* FlowFlags.SwitchClause */, antecedent: antecedent, switchStatement: switchStatement, clauseStart: clauseStart, clauseEnd: clauseEnd });

Callers 4

bindConditionFunction · 0.85
bindOptionalExpressionFunction · 0.85
bindOptionalChainFunction · 0.85

Calls 3

isNarrowingExpressionFunction · 0.85
setFlowNodeReferencedFunction · 0.85
initFlowNodeFunction · 0.85

Tested by

no test coverage detected