variableLiteral.js 370 B

12345678910111213141516171819202122
  1. import { Literal } from "./literal";
  2. import { Types } from "./../../typeSystem/types";
  3. export class VariableLiteral extends Literal {
  4. constructor (id) {
  5. super(Types.UNDEFINED);
  6. this.id = id;
  7. }
  8. get value () {
  9. return this.id;
  10. }
  11. toString () {
  12. if (this.parenthesis) {
  13. return `(${this.id})`;
  14. } else {
  15. return this.id;
  16. }
  17. }
  18. }