MCPcopy Create free account
hub / github.com/facebook/react / findHOCCallPathsAbove

Function findHOCCallPathsAbove

packages/react-refresh/src/ReactFreshBabelPlugin.js:354–384  ·  view source on GitHub ↗
(path)

Source from the content-addressed store, hash-verified

352 }
353
354 function findHOCCallPathsAbove(path) {
355 const calls = [];
356 while (true) {
357 if (!path) {
358 return calls;
359 }
360 const parentPath = path.parentPath;
361 if (!parentPath) {
362 return calls;
363 }
364 if (
365 // hoc(_c = function() { })
366 parentPath.node.type === 'AssignmentExpression' &&
367 path.node === parentPath.node.right
368 ) {
369 // Ignore registrations.
370 path = parentPath;
371 continue;
372 }
373 if (
374 // hoc1(hoc2(...))
375 parentPath.node.type === 'CallExpression' &&
376 path.node !== parentPath.node.callee
377 ) {
378 calls.push(parentPath);
379 path = parentPath;
380 continue;
381 }
382 return calls; // Stop at other types.
383 }
384 }
385
386 const seenForRegistration = new WeakSet();
387 const seenForSignature = new WeakSet();

Callers 1

exitFunction · 0.85

Calls 1

pushMethod · 0.65

Tested by

no test coverage detected