MCPcopy Create free account
hub / github.com/cortex-js/compute-engine / paramsOf

Function paramsOf

scripts/fungrim/load.ts:234–246  ·  view source on GitHub ↗
(head: string)

Source from the content-addressed store, hash-verified

232 * declared `function`, and this wins over any Element conjunct. The engine
233 * (strict mode) reports `expected-function` when a symbol declared with a
234 * non-function type is applied, so declaring such a variable `complex` makes
235 * the whole entry fail Stage 1. A `DirichletGroup` membership, for example,
236 * falls through `inferType` to `complex`, yet `chi` is a function.
237 */
238export function variableTypes(e: Entry): Record<string, string> {
239 const types: Record<string, string> = {};
240 const applied = new Set<string>();
241 const vars = new Set(e.variables);
242 const walk = (x: unknown): void => {
243 if (!Array.isArray(x)) return;
244 if (typeof x[0] === 'string' && vars.has(x[0])) applied.add(x[0]);
245 if (x[0] === 'Element' && typeof x[1] === 'string' && x.length >= 3)
246 types[x[1]] ??= inferType(x[2]);
247 for (const y of x) walk(y);
248 };
249 walk(e.assumptions);

Callers 1

walkFunction · 0.85

Calls 7

hasMethod · 0.65
getMethod · 0.65
toStringMethod · 0.65
exprMethod · 0.65
matchMethod · 0.65
mapMethod · 0.65
setMethod · 0.65

Tested by

no test coverage detected