Skip to content

FunctionDecl

FunctionDecl defines a function name, overload set, and optionally a singleton definition for all overload instances.

new FunctionDecl(nameValue, options?): FunctionDecl

Constructor accepts the function name and plain TypeScript option-object configuration.

string

FunctionDeclOptions = {}

FunctionDecl

addOverload(overload): void

AddOverload ensures that the new overload does not collide with an existing overload signature; however, if the function signatures are identical, the implementation may be rewritten as its difficult to compare functions by object identity.

OverloadDecl

void


bindings(): Overload[]

Bindings produces a set of function bindings, if any are defined.

Overload[]


description(): string

Description provides an overview of the function’s purpose.

Usage examples should be included on specific overloads.

string


documentation(): Doc

Documentation generates documentation about the Function and its overloads as a common.Doc object.

Doc


hasLateBinding(): boolean

HasLateBinding returns true if the function has late bindings. A function cannot mix late bindings with other bindings.

boolean


hasSingletonBinding(): boolean

HasSingletonBinding indicates whether the function has a singleton binding definition.

boolean


isDeclarationDisabled(): boolean

IsDeclarationDisabled indicates that the function declaration should not be exposed for expressions.

boolean


merge(other): FunctionDecl

Merge combines an existing function declaration with another.

If a function is extended, by say adding new overloads to an existing function, then it is merged with the prior definition of the function at which point its overloads must not collide with pre-existing overloads and its bindings (singleton, or per-overload) must not conflict with previous definitions either.

FunctionDecl

FunctionDecl


name(): string

Name returns the function name in human-readable terms, e.g. ‘contains’ of ‘math.least’

string


overloadDecls(): OverloadDecl[]

OverloadDecls returns the overload declarations in declaration order.

OverloadDecl[]


subset(selector): FunctionDecl | undefined

Subset returns a new function declaration which contains only the overloads with the specified IDs. If the subset function contains no overloads, then undefined is returned to indicate the function is not functional.

OverloadSelector

FunctionDecl | undefined