UNPKG

@akala/core

Version:
48 lines 1.76 kB
import { Expression } from './expression.js'; import { ExpressionType } from './expression-type.js'; /** * Represents an expression that applies a symbol (property/method) to a source expression with an optional argument. * @template T - The type of the source expression's result value * @template U - The resulting type after applying the symbol * @implements {IVisitable<ExpressionVisitor, StrictExpressions>} */ export class ApplySymbolExpression extends Expression { /** * Gets the type of the expression. * @returns {ExpressionType.ApplySymbolExpression} The expression type constant */ get type() { return ExpressionType.ApplySymbolExpression; } /** * The source expression to which the symbol is applied */ source; /** * The symbol (property or method) being applied */ symbol; /** * Optional argument passed when invoking the symbol */ argument; /** * Creates a new ApplySymbolExpression instance * @param {TypedExpression<T>} source - The base expression to apply the symbol to * @param {symbol} symbol - The property/method symbol to invoke * @param {StrictExpressions} [argument] - Optional argument value for the symbol invocation */ constructor(source, symbol, argument) { super(); this.source = source; this.symbol = symbol; this.argument = argument; } /** * Accepts a visitor for the visitor pattern * @param {ExpressionVisitor} visitor - The visitor to process this node * @returns {StrictExpressions} The result of the visitor's processing */ accept(visitor) { return visitor.visitApplySymbol(this); } } //# sourceMappingURL=apply-symbol-expression.js.map