MCPcopy Create free account
hub / github.com/TanStack/db / collectRefsFromExpression

Function collectRefsFromExpression

packages/db/src/query/builder/index.ts:1087–1102  ·  view source on GitHub ↗

* Recursively collects all PropRef nodes from an expression tree.

(expr: BasicExpression)

Source from the content-addressed store, hash-verified

1085 * Recursively collects all PropRef nodes from an expression tree.
1086 */
1087function collectRefsFromExpression(expr: BasicExpression): Array<PropRef> {
1088 const refs: Array<PropRef> = []
1089 switch (expr.type) {
1090 case `ref`:
1091 refs.push(expr)
1092 break
1093 case `func`:
1094 for (const arg of (expr as any).args ?? []) {
1095 refs.push(...collectRefsFromExpression(arg))
1096 }
1097 break
1098 default:
1099 break
1100 }
1101 return refs
1102}
1103
1104/**
1105 * Checks whether a WHERE clause references any parent alias.

Callers 2

referencesParentFunction · 0.85
buildIncludesSubqueryFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected