import { TreeMap } from "../maps/treemap"; import { DefinedAttributes, AttributeTypes, Attribute, AttributeConstructor } from "./attributes"; /** * Arguments available when computing a synthetic attribute. */ export interface SyntheticArg { children: Array; node: T & A; anno: (n: T) => T & A; } /** * Type signature of the function that computes synthetic attributes. */ export declare type SyntheticFunction = (args: SyntheticArg>) => R; export interface NamedSyntheticFunction { name: N; f: SyntheticFunction; } export declare function namedSynthetic(key: N): (f: (args: SyntheticArg) => R) => NamedSyntheticFunction; /** * Options associated with computed synthetic attributes. */ export interface SyntheticOptions { memoize?: boolean; } /** * This function creates an `Attribute` that returns the value of the synthetic * attribute. It will invoke the provided `evaluate` function to do this, but * it will try to minimize the invocation of that function. It also manages * "walking the tree" to retrieve child values on demand. * @param evaluate * @param tree * @param attrs * @param memoize * @returns */ export declare function syntheticAttribute(f: SyntheticFunction, tree: TreeMap, attrs: DefinedAttributes, memoize: boolean): Attribute; export declare function synthetic(name: N, f: SyntheticFunction, memoize?: boolean): AttributeConstructor;