function.js 462 B

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