UNPKG

expression-evaluation

Version:
30 lines (29 loc) 827 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Node = void 0; const ParserFrame_js_1 = require("./ParserFrame.js"); class Node extends ParserFrame_js_1.ParserFrame { constructor(frame) { super(frame.expr, frame.start, frame.end); } get constant() { return false; } get signature() { return; } reduceType(type) { const compiledType = this.type.reduce(type); if (compiledType) { return compiledType; } this.throwTypeError(type); } throwTypeError(type) { return this.throwError(`type ${this.type} mismatch with expected type ${type}`); } toString(ident = 0) { return ' '.repeat(ident) + `[${this._start}:${this.end}] <${this.type}>`; } } exports.Node = Node;