expression-evaluation
Version:
Expression Evaluation
26 lines (25 loc) • 690 B
JavaScript
import { ParserFrame } from './ParserFrame.js';
export class Node extends 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}>`;
}
}