Переглянути джерело

Create class CommandBlock
Command index.js format

Lucas de Souza 6 роки тому
батько
коміт
2c79efd18c
3 змінених файлів з 19 додано та 2 видалено
  1. 7 0
      js/ast/commands/commandBlock.js
  2. 11 1
      js/ast/commands/index.js
  3. 1 1
      js/ast/ivprogParser.js

+ 7 - 0
js/ast/commands/commandBlock.js

@@ -0,0 +1,7 @@
+export class CommandBlock {
+	
+	constructor(variables, commands) {
+		this.variables = variables;
+		this.commands = commands;
+	}
+}

+ 11 - 1
js/ast/commands/index.js

@@ -7,7 +7,17 @@ import { While } from './while';
 import { For } from './for';
 import { Function } from './function';
 import { IfThenElse } from './ifThenElse';
+import { CommandBlock } from './commandBlock';
 
 export {
-  Break, Return, Assign, Declaration, ArrayDeclaration, While, For, Function, IfThenElse
+  Break,
+  Return,
+  Assign,
+  Declaration,
+  ArrayDeclaration,
+  While,
+  For,
+  Function,
+  IfThenElse,
+  CommandBlock
 };

+ 1 - 1
js/ast/ivprogParser.js

@@ -507,7 +507,7 @@ export class IVProgParser {
     this.checkCloseCurly();
     this.pos++;
     this.consumeNewLines();
-    return {variables: variablesDecl, commands: commands};
+    return new Commands.CommandBlock(variablesDecl, commands);
   }
 
   parseIfThenElse () {