UNPKG

mathjslab

Version:

MathJSLab - An interpreter with language syntax like MATLAB®/Octave, ISBN 978-65-00-82338-7.

46 lines (45 loc) 2.05 kB
import type { ExpressionBoundaryValue, NodeExpr } from './AST'; import type { Callable } from './Callable'; import type { Scope } from './Scope'; /** * Represents one interpreter call-frame. * * Frames are pushed for built-ins, user-defined functions, anonymous function * handles, and temporary `eval` execution. They provide: * * - the active workspace for lookup and assignment, * - the callable currently being executed, * - metadata used by `nargin`, `nargout`, `inputname`, and stack traces, * - a linked `parentFrame` chain for MATLAB/Octave-like caller lookup. * * Stack/error formatting lives outside this class; this remains a small data * holder so stack-management helpers can use it without depending on the full * interpreter implementation. */ declare class CallFrame { scope: Scope; func?: Callable | undefined; callSite?: NodeExpr | undefined; name?: string | undefined; nargin: number; nargout: number; inputArgs: ExpressionBoundaryValue[]; parentFrame?: CallFrame | undefined; outputMask: boolean[]; /** * Create a call frame. * * @param scope Workspace associated with this frame. * @param func Callable being executed, when the frame represents a call. * @param callSite AST node that originated the call, used for diagnostics. * @param name Display name used by stack traces and introspection. * @param nargin Number of input arguments supplied by the caller. * @param nargout Number of output values requested by the caller. * @param inputArgs Original unevaluated call arguments, used by `inputname`. * @param parentFrame Caller frame. * @param outputMask Per-output request flags used by `isargout`. */ constructor(scope: Scope, func?: Callable | undefined, callSite?: NodeExpr | undefined, name?: string | undefined, nargin?: number, nargout?: number, inputArgs?: ExpressionBoundaryValue[], parentFrame?: CallFrame | undefined, outputMask?: boolean[]); } export { CallFrame }; export default CallFrame;