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

Function isPostSuperFlowNode

test/fixtures/snapshot/typescript.js:70246–70287  ·  view source on GitHub ↗
(flow, noCacheCheck)

Source from the content-addressed store, hash-verified

70244 // Return true if the given flow node is preceded by a 'super(...)' call in every possible code path
70245 // leading to the node.
70246 function isPostSuperFlowNode(flow, noCacheCheck) {
70247 while (true) {
70248 var flags = flow.flags;
70249 if (flags & 4096 /* FlowFlags.Shared */) {
70250 if (!noCacheCheck) {
70251 var id = getFlowNodeId(flow);
70252 var postSuper = flowNodePostSuper[id];
70253 return postSuper !== undefined ? postSuper : (flowNodePostSuper[id] = isPostSuperFlowNode(flow, /*noCacheCheck*/ true));
70254 }
70255 noCacheCheck = false;
70256 }
70257 if (flags & (16 /* FlowFlags.Assignment */ | 96 /* FlowFlags.Condition */ | 256 /* FlowFlags.ArrayMutation */ | 128 /* FlowFlags.SwitchClause */)) {
70258 flow = flow.antecedent;
70259 }
70260 else if (flags & 512 /* FlowFlags.Call */) {
70261 if (flow.node.expression.kind === 106 /* SyntaxKind.SuperKeyword */) {
70262 return true;
70263 }
70264 flow = flow.antecedent;
70265 }
70266 else if (flags & 4 /* FlowFlags.BranchLabel */) {
70267 // A branching point is post-super if every branch is post-super.
70268 return ts.every(flow.antecedents, function (f) { return isPostSuperFlowNode(f, /*noCacheCheck*/ false); });
70269 }
70270 else if (flags & 8 /* FlowFlags.LoopLabel */) {
70271 // A loop is post-super if the control flow path that leads to the top is post-super.
70272 flow = flow.antecedents[0];
70273 }
70274 else if (flags & 1024 /* FlowFlags.ReduceLabel */) {
70275 var target = flow.target;
70276 var saveAntecedents = target.antecedents;
70277 target.antecedents = flow.antecedents;
70278 var result = isPostSuperFlowNode(flow.antecedent, /*noCacheCheck*/ false);
70279 target.antecedents = saveAntecedents;
70280 return result;
70281 }
70282 else {
70283 // Unreachable nodes are considered post-super to silence errors
70284 return !!(flags & 1 /* FlowFlags.Unreachable */);
70285 }
70286 }
70287 }
70288 function isConstantReference(node) {
70289 switch (node.kind) {
70290 case 79 /* SyntaxKind.Identifier */: {

Callers 1

checkThisBeforeSuperFunction · 0.85

Calls 2

getFlowNodeIdFunction · 0.85
everyMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…