Files
DiceCloud/app/imports/parser/parseTree/ConstantNode.js
2020-09-18 10:14:53 +02:00

23 lines
498 B
JavaScript

import ParseNode from '/imports/parser/parseTree/ParseNode.js';
export default class ConstantNode extends ParseNode {
constructor({value, type}){
super(...arguments);
// string, number, boolean, uncompiledNode
this.type = type;
this.value = value;
}
compile(){
return this;
}
toString(){
return `${this.value}`;
}
get isNumber(){
return this.type === 'number';
}
get isInteger(){
return this.type === 'number' && Number.isInteger(this.value);
}
}