import { Documented } from './documented'; import { Expression } from './expressions'; import { Parameter, ParameterSpec } from './parameter'; import { IScope } from './scope'; import { Statement } from './statements'; import { Block } from './statements/block'; import { Type } from './type'; import { DeclarationKind, Exported, TypeDeclaration, TypeSpec } from './type-declaration'; export interface CallableSpec extends TypeSpec { name: string; parameters?: ParameterSpec[]; returnType?: Type; body?: Block; } export interface CallableDeclaration extends Documented { readonly body?: Block; readonly returnType: Type; readonly name: string; readonly parameters: Parameter[]; } export interface CallableExpr { invoke(...args: Expression[]): Expression; } /** * Can't be called "Function" */ export declare class FreeFunction extends TypeDeclaration implements CallableDeclaration, Exported { readonly scope: IScope; readonly spec: CallableSpec; readonly returnType: Type; readonly kind = DeclarationKind.Function; readonly parameters: Parameter[]; private _body?; constructor(scope: IScope, spec: CallableSpec); get name(): string; get fn(): Expression; get body(): Block | undefined; addBody(...stmts: Array): void; addParameter(spec: ParameterSpec): Parameter; } export declare function isCallableDeclaration(x: unknown): x is CallableDeclaration;