MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / isValueReference

Function isValueReference

__tests__/child-process-windows-hide.test.ts:143–150  ·  view source on GitHub ↗

* True when `id` reads the binding it names as a value. False for a type * position (`typeof execFileSync`), and for an identifier that only names a * declaration or a member: `x.exec`, `{ exec: … }`, `const spawn = …`, the * import specifier itself. A re-export (`export { spawn }`) and a shortha

(id: ts.Identifier)

Source from the content-addressed store, hash-verified

141 * property (`{ spawn }`) DO read the value.
142 */
143function isValueReference(id: ts.Identifier): boolean {
144 for (let n: ts.Node | undefined = id.parent; n; n = n.parent) if (ts.isTypeNode(n)) return false;
145 const p = id.parent as ts.Node & { name?: ts.Node; propertyName?: ts.Node };
146 if (ts.isShorthandPropertyAssignment(p) || ts.isExportSpecifier(p)) return true;
147 if (p.name === id || p.propertyName === id) return false;
148 if (ts.isQualifiedName(p) && p.right === id) return false;
149 return true;
150}
151
152/** Variable initializer or function parameter that `name` refers to at `from`. */
153function resolveBinding(name: string, from: ts.Node): ts.VariableDeclaration | ts.ParameterDeclaration | null {

Callers 1

visitFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected