* Recursively collects all PropRef references from an expression. * * @param expr - The expression to traverse * @returns Array of PropRef references found in the expression
(expr: any)
| 1083 | * @returns Array of PropRef references found in the expression |
| 1084 | */ |
| 1085 | function collectRefs(expr: any): Array<PropRef> { |
| 1086 | const refs: Array<PropRef> = [] |
| 1087 | |
| 1088 | if (expr == null || typeof expr !== `object`) return refs |
| 1089 | |
| 1090 | switch (expr.type) { |
| 1091 | case `ref`: |
| 1092 | refs.push(expr as PropRef) |
| 1093 | break |
| 1094 | case `func`: |
| 1095 | case `agg`: |
| 1096 | for (const arg of expr.args ?? []) { |
| 1097 | refs.push(...collectRefs(arg)) |
| 1098 | } |
| 1099 | break |
| 1100 | default: |
| 1101 | break |
| 1102 | } |
| 1103 | |
| 1104 | return refs |
| 1105 | } |
| 1106 | |
| 1107 | /** |
| 1108 | * Determines whether the provided WHERE clause references fields that are |
no outgoing calls
no test coverage detected