Explorar el Código

Fix bug with for assignment command using VarLiteral instead of a string

Lucas de Souza hace 5 años
padre
commit
e4fa6c8210
Se han modificado 1 ficheros con 2 adiciones y 2 borrados
  1. 2 2
      js/processor/ivprogProcessor.js

+ 2 - 2
js/processor/ivprogProcessor.js

@@ -317,7 +317,7 @@ export class IVProgProcessor {
    */
   executeFor (store, cmd) {
     //BEGIN for -> while rewrite
-    const initCmd = new Commands.Assign(cmd.for_id, cmd.for_from);
+    const initCmd = new Commands.Assign(cmd.for_id.id, cmd.for_from);
     initCmd.sourceInfo = cmd.sourceInfo;
     const is_forward_exp = new Expressions.InfixApp(Operators.GE, cmd.for_to, cmd.for_from);
     return this.evaluateExpression(store, is_forward_exp).then (result => {
@@ -337,7 +337,7 @@ export class IVProgProcessor {
           pass_value = new Expressions.IntLiteral(toInt(-1));
         }
       }
-      const increment = new Commands.Assign(cmd.for_id,
+      const increment = new Commands.Assign(cmd.for_id.id,
         new Expressions.InfixApp(Operators.ADD, cmd.for_id, pass_value));
         increment.sourceInfo = cmd.sourceInfo;
       const whileBlock = new Commands.CommandBlock([],