fix for while-loop-ending-with-if bug
This commit is contained in:
@@ -233,6 +233,9 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> {
|
||||
condition.condJump(elseLabel, true, v); // == 0, i.e. false
|
||||
|
||||
Label end = continueLabel == null ? new Label() : continueLabel;
|
||||
|
||||
if(continueLabel != null)
|
||||
asmType = Type.VOID_TYPE;
|
||||
|
||||
gen(thenExpression, asmType);
|
||||
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
import java.lang.Runtime
|
||||
|
||||
fun box() : String {
|
||||
val processors = Runtime.getRuntime().sure().availableProcessors()
|
||||
var threadNum = 1
|
||||
while(threadNum <= 1024) {
|
||||
System.out?.println(threadNum)
|
||||
if(threadNum < 2 * processors)
|
||||
threadNum += 1
|
||||
else
|
||||
threadNum *= 2
|
||||
}
|
||||
return "OK"
|
||||
}
|
||||
@@ -244,6 +244,12 @@ public class ControlStructuresTest extends CodegenTestCase {
|
||||
public void testSynchronized() throws Exception {
|
||||
createEnvironmentWithFullJdk();
|
||||
blackBoxFile("controlStructures/sync.jet");
|
||||
// System.out.println(generateToText());
|
||||
}
|
||||
|
||||
public void testIfInWhile() throws Exception {
|
||||
createEnvironmentWithFullJdk();
|
||||
blackBoxFile("controlStructures/ifInWhile.jet");
|
||||
// System.out.println(generateToText());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user