UNPKG

@akala/core

Version:
34 lines 1.01 kB
import { Expression } from './expression.js'; import { ExpressionType } from './expression-type.js'; /** * Represents a constant expression. * @template T - The type of the constant value. */ export class ConstantExpression extends Expression { value; /** * Gets the type of the expression. * @returns {ExpressionType.ConstantExpression} The type of the expression. */ get type() { return ExpressionType.ConstantExpression; } /** * Initializes a new instance of the ConstantExpression class. * @param {T} value - The constant value. */ constructor(value) { super(); this.value = value; } /** * Accepts a visitor. * @param {ExpressionVisitor} visitor - The visitor to accept. * @returns {any} The result of the visitor's visit. */ accept(visitor) { return visitor.visitConstant(this); } toString() { return this.value.toString(); } } //# sourceMappingURL=constant-expression.js.map