MCPcopy Create free account
hub / github.com/facebook/memlab / findParentFunctionPath

Method findParentFunctionPath

packages/e2e/src/code-analysis/Script.ts:80–97  ·  view source on GitHub ↗
(
    path: NodePath<FunctionClass | Identifier>,
  )

Source from the content-addressed store, hash-verified

78 }
79
80 private findParentFunctionPath(
81 path: NodePath<FunctionClass | Identifier>,
82 ): Nullable<NodePath<FunctionClass | Program>> {
83 let curPath = path.parentPath;
84 while (curPath) {
85 if (
86 isFunctionType(curPath.node.type) ||
87 curPath.node.type === 'Program'
88 ) {
89 return curPath as NodePath<FunctionClass | Program>;
90 }
91 if (curPath.parentPath == null) {
92 break;
93 }
94 curPath = curPath.parentPath;
95 }
96 return null;
97 }
98
99 private findParentFunctionClosureScope(
100 locToClosureScopeMap: Map<string, ClosureScope>,

Calls 1

isFunctionTypeFunction · 0.85

Tested by

no test coverage detected