boolLiteral.js 439 B

1234567891011121314151617181920
  1. import { Literal } from './literal';
  2. import { Types } from './../../typeSystem/types';
  3. import { convertBoolToString } from "./../../typeSystem/parsers";
  4. export class BoolLiteral extends Literal {
  5. constructor(value) {
  6. super(Types.BOOLEAN);
  7. this.value = value;
  8. }
  9. toString () {
  10. const text = convertBoolToString(this.value);
  11. if(this.parenthesis) {
  12. return `(${text})`
  13. } else {
  14. return text;
  15. }
  16. }
  17. }