/** * Main Expression Dispatch * * Provides the main entry points for expression evaluation and dispatches * to specialized evaluators based on AST node type. * * This is the central coordination point that ties together all other evaluator handlers. * * Interface requirements: * - evaluateExpression(expr) -> Promise * - evaluatePipeChain(chain) -> Promise * - evaluatePostfixExpr(expr) -> Promise * - evaluatePrimary(primary) -> Promise * - evaluatePipeTarget(target, input) -> Promise * * Error Handling: * - Unsupported expression types throw RuntimeError * - Aborted execution halts via RuntimeHaltSignal * * @internal */ import type { ExpressionNode, PipeChainNode, PostfixExprNode, PrimaryNode } from '../../../../types.js'; import type { RillValue } from '../../types/structures.js'; import type { EvalState } from '../state.js'; /** * Main expression evaluation entry point. * Delegates to pipe chain evaluator. */ export declare function evaluateExpression(s: EvalState, expr: ExpressionNode): Promise; /** * Evaluate pipe chain with left-to-right flow. * * Pipe chains isolate their $ value from parent scope. * The chain's result is returned, but $ modifications don't leak. * * Handles chain terminators: * - Capture: stores value and returns it * - Break: throws BreakSignal with value * - Return: throws ReturnSignal with value */ export declare function evaluatePipeChain(s: EvalState, chain: PipeChainNode): Promise; /** * Evaluate postfix expression: primary with method chain. * * Example: obj.method1().method2().method3() * Evaluates primary, then applies each method in sequence. * * Default value handling: * - If the method chain throws a recoverable missing-member error and * expr.defaultValue exists, evaluates and returns defaultValue instead * of propagating the error. * - Recoverable missing-member errors are matched by error id: RILL_R007 * (missing method or field on a value) and RILL_R008 (annotation key * not found). Both legacy RuntimeError and migrated RuntimeHaltSignal * forms are recognised via `matchesErrorId`. * - If the primary+method-chain produces an invalid RillValue (e.g. from * `guard`/`retry` recovery) and expr.defaultValue exists, the default * expression is evaluated and returned. * - All other errors propagate normally. */ export declare function evaluatePostfixExpr(s: EvalState, expr: PostfixExprNode): Promise; /** * Evaluate primary expression. * * Primary expressions are the atomic units of expressions: * - Literals (string, number, boolean, tuple, dict, closure) * - Variables * - Function calls * - Control flow constructs * - Grouped expressions * * Extension: to add a new PrimaryNode type, (1) add the node to the AST * union in ast-nodes.ts and ast-unions.ts, (2) add an evaluation function * to the appropriate module, (3) add a case here delegating to that * function. The default branch surfaces any unhandled type at runtime so * TypeScript exhaustiveness remains in force. */ export declare function evaluatePrimary(s: EvalState, primary: PrimaryNode): Promise;