Wrap a lambda so each invocation is counted against `recursionLimit`: a * runaway user-function recursion (`f(x) := … f(x-1) …` with no reachable base * case) throws a `CancellationError` (`cause: 'recursion-depth-exceeded'`) * instead of overflowing the native JS call stack with a `RangeError`.
( ce: ComputeEngine, fn: (params: ReadonlyArray<Expression>) => Expression | undefined )
| 433 | export function canonicalFunctionLiteralOperands( |
| 434 | ce: ComputeEngine, |
| 435 | ops: ReadonlyArray<Expression> |
| 436 | ): Expression | undefined { |
| 437 | if (ops.length === 1) { |
| 438 | const [body, params] = anonymousParameters(ops[0]); |
| 439 | if (params.length > 0) |
| 440 | return canonicalFunctionLiteralArguments(ce, [body, ...params]); |
| 441 | } |
| 442 | return canonicalFunctionLiteralArguments(ce, ops); |
| 443 | } |
| 444 | |
| 445 | /** |
| 446 | * The anonymous ("wildcard") parameters `_`, `_1`, … `_9` that `expr` uses, in |
| 447 | * index order, together with the body in which the bare `_` has been |
| 448 | * normalized to `_1`. The parameter list is empty when the expression uses no |
| 449 | * wildcard — the caller then decides what the parameters are (the shorthand |
| 450 | * path falls back to the body's unknowns; the `["Function", body]` path keeps |
no test coverage detected