function.js 503 B

1234567891011121314151617181920212223
  1. import { Types } from './../types';
  2. export class Function {
  3. constructor(name, returnType, formalParameters, commandBlock) {
  4. this.name = name;
  5. this.returnType = returnType;
  6. this.formalParameters = formalParameters;
  7. this.commandBlock = commandBlock;
  8. }
  9. get isMain () {
  10. return this.name === null && this.returnType === Types.VOID;
  11. }
  12. get commands () {
  13. return this.commandBlock.commands;
  14. }
  15. get variablesDeclarations () {
  16. return this.commandBlock.variables;
  17. }
  18. }