Skip to content

Commit

Permalink
Minor fix in continue statement
Browse files Browse the repository at this point in the history
  • Loading branch information
Franco Montenegro committed May 25, 2016
1 parent 1386702 commit f0f8047
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.ruke.vrjassc.translator.expression;

import com.ruke.vrjassc.vrjassc.symbol.BuiltInTypeSymbol;
import com.ruke.vrjassc.vrjassc.symbol.Modifier;
import com.ruke.vrjassc.vrjassc.symbol.Symbol;

/**
Expand All @@ -19,6 +20,7 @@ protected void registerContinue() {

this._continue = new Symbol("vr_c_" + LOOP_CONTINUE_COUNTER, null, null);
this._continue.setType(new BuiltInTypeSymbol("boolean", null, null));
this._continue.setModifier(Modifier.LOCAL, true);

this.add(new VariableStatement(this._continue, null));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import com.ruke.vrjassc.vrjassc.symbol.Symbol;
import org.junit.Assert;
import org.junit.Test;
import sun.java2d.SunGraphicsEnvironment;

import java.util.ArrayList;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ public class FunctionTest extends TestHelper {
public void continueStatement() {
String code =
"function foo\n" +
"local integer i\n" +
"set i = 1\n" +
"local integer i = 0\n" +
"loop\n" +
"set i = i + 1\n" +
"exitwhen i > 9\n" +
"if i == 3 then\n" +
"continue\n" +
Expand All @@ -23,20 +23,19 @@ public void continueStatement() {
"continue\n" +
"endif\n" +
"call BJDebugMsg(I2S(i))\n" +
"set i = i + 1\n" +
"endloop\n" +
"end";

String expected =
"globals\n" +
"endglobals\n" +
"function foo takes nothing returns nothing\n" +
"boolean vr_c_0=false\n" +
"local boolean vr_c_0=false\n" +
"local integer i=0\n" +
"set i=1\n" +
"loop\n" +
"set vr_c_0=false\n" +
"loop\n" +
"set i=i+1\n" +
"exitwhen i>9\n" +
"if i==3 then\n" +
"set vr_c_0=true\n" +
Expand All @@ -47,7 +46,6 @@ public void continueStatement() {
"exitwhen true\n" +
"endif\n" +
"call BJDebugMsg(I2S(i))\n" +
"set i=i+1\n" +
"endloop\n" +
"exitwhen vr_c_0==false\n" +
"endloop\n" +
Expand Down

0 comments on commit f0f8047

Please sign in to comment.