UNPKG

js-slang

Version:

Javascript-based implementations of Source, written in Typescript

29 lines (28 loc) 1.15 kB
import * as es from 'estree'; import { Context, Environment } from '../types'; declare class Callable extends Function { constructor(f: any); } /** * Models function value in the CSE machine. */ export default class Closure extends Callable { node: es.ArrowFunctionExpression; environment: Environment; static makeFromArrowFunction(node: es.ArrowFunctionExpression, environment: Environment, context: Context, dummyReturn?: boolean, predefined?: boolean): Closure; /** Unique ID defined for closure */ readonly id: string; /** Name of the constant declaration that the closure is assigned to */ declaredName?: string; /** String representation of the closure, e.g. `x => ...` */ functionName: string; /** Fake closure function */ fun: Function; /** Keeps track of whether the closure is a pre-defined function */ predefined: boolean; /** The original node that created this Closure */ originalNode: es.ArrowFunctionExpression; constructor(node: es.ArrowFunctionExpression, environment: Environment, context: Context, isPredefined?: boolean); toString(): string; } export {};