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

Function getTypeAtFlowNode

test/fixtures/snapshot/typescript.js:70334–70430  ·  view source on GitHub ↗
(flow)

Source from the content-addressed store, hash-verified

70332 return key = getFlowCacheKey(reference, declaredType, initialType, flowContainer);
70333 }
70334 function getTypeAtFlowNode(flow) {
70335 if (flowDepth === 2000) {
70336 // We have made 2000 recursive invocations. To avoid overflowing the call stack we report an error
70337 // and disable further control flow analysis in the containing function or module body.
70338 ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.instant("checkTypes" /* tracing.Phase.CheckTypes */, "getTypeAtFlowNode_DepthLimit", { flowId: flow.id });
70339 flowAnalysisDisabled = true;
70340 reportFlowControlError(reference);
70341 return errorType;
70342 }
70343 flowDepth++;
70344 var sharedFlow;
70345 while (true) {
70346 var flags = flow.flags;
70347 if (flags & 4096 /* FlowFlags.Shared */) {
70348 // We cache results of flow type resolution for shared nodes that were previously visited in
70349 // the same getFlowTypeOfReference invocation. A node is considered shared when it is the
70350 // antecedent of more than one node.
70351 for (var i = sharedFlowStart; i < sharedFlowCount; i++) {
70352 if (sharedFlowNodes[i] === flow) {
70353 flowDepth--;
70354 return sharedFlowTypes[i];
70355 }
70356 }
70357 sharedFlow = flow;
70358 }
70359 var type = void 0;
70360 if (flags & 16 /* FlowFlags.Assignment */) {
70361 type = getTypeAtFlowAssignment(flow);
70362 if (!type) {
70363 flow = flow.antecedent;
70364 continue;
70365 }
70366 }
70367 else if (flags & 512 /* FlowFlags.Call */) {
70368 type = getTypeAtFlowCall(flow);
70369 if (!type) {
70370 flow = flow.antecedent;
70371 continue;
70372 }
70373 }
70374 else if (flags & 96 /* FlowFlags.Condition */) {
70375 type = getTypeAtFlowCondition(flow);
70376 }
70377 else if (flags & 128 /* FlowFlags.SwitchClause */) {
70378 type = getTypeAtSwitchClause(flow);
70379 }
70380 else if (flags & 12 /* FlowFlags.Label */) {
70381 if (flow.antecedents.length === 1) {
70382 flow = flow.antecedents[0];
70383 continue;
70384 }
70385 type = flags & 4 /* FlowFlags.BranchLabel */ ?
70386 getTypeAtFlowBranchLabel(flow) :
70387 getTypeAtFlowLoopLabel(flow);
70388 }
70389 else if (flags & 256 /* FlowFlags.ArrayMutation */) {
70390 type = getTypeAtFlowArrayMutation(flow);
70391 if (!type) {

Callers 8

getFlowTypeOfReferenceFunction · 0.85
getTypeAtFlowAssignmentFunction · 0.85
getTypeAtFlowCallFunction · 0.85
getTypeAtFlowConditionFunction · 0.85
getTypeAtSwitchClauseFunction · 0.85
getTypeAtFlowBranchLabelFunction · 0.85
getTypeAtFlowLoopLabelFunction · 0.85

Calls 9

reportFlowControlErrorFunction · 0.85
getTypeAtFlowAssignmentFunction · 0.85
getTypeAtFlowCallFunction · 0.85
getTypeAtFlowConditionFunction · 0.85
getTypeAtSwitchClauseFunction · 0.85
getTypeAtFlowBranchLabelFunction · 0.85
getTypeAtFlowLoopLabelFunction · 0.85
convertAutoToAnyFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…