Browse Source

Fix switch...case being created without main expression

Lucas de Souza 5 years ago
parent
commit
cc3f5da630
2 changed files with 3 additions and 2 deletions
  1. 2 1
      js/ast/commands/switch.js
  2. 1 1
      js/ast/ivprogParser.js

+ 2 - 1
js/ast/commands/switch.js

@@ -1,6 +1,7 @@
 export class Switch {
   
-  constructor (cases) {
+  constructor (expression, cases) {
+    this.expression = expression;
     this.cases = cases;
   }
 }

+ 1 - 1
js/ast/ivprogParser.js

@@ -587,7 +587,7 @@ export class IVProgParser {
     this.consumeNewLines();
 
     this.popScope();
-    return new Commands.Switch(casesList);
+    return new Commands.Switch(exp, casesList);
   }
 
   parseDoWhile () {