Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
08d57b0da4 |
No files matched your search
@@ -1,19 +0,0 @@
|
|||||||
import java.lang.Integer;
|
|
||||||
import java.lang.System;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.io.PrintStream;
|
|
||||||
|
|
||||||
public class Bug458 {
|
|
||||||
public static main(args) {
|
|
||||||
List<Integer> l = new ArrayList<Integer>();
|
|
||||||
l.add(1);
|
|
||||||
l.add(2);
|
|
||||||
Integer s = 0;
|
|
||||||
for (Integer x : l) {
|
|
||||||
if (x == 1) { continue; } // "break" is rejected as well
|
|
||||||
s = s + x;
|
|
||||||
}
|
|
||||||
System.out.println(s); // Java: 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
import java.lang.Integer;
|
||||||
|
import java.lang.Object;
|
||||||
|
import java.lang.System;
|
||||||
|
import java.io.PrintStream;
|
||||||
|
|
||||||
|
public class Bug466 {
|
||||||
|
public void p(Object o) { System.out.println(o.toString()); }
|
||||||
|
public run() {
|
||||||
|
var a = 3;
|
||||||
|
p(-(a + 10)); // Java: -13
|
||||||
|
}
|
||||||
|
public static main(args) { new Bug466().run(); }
|
||||||
|
}
|
||||||
@@ -1305,11 +1305,6 @@ public class Codegen {
|
|||||||
mv.visitMethodInsn(INVOKEINTERFACE, "java/lang/Iterable", "iterator", "()Ljava/util/Iterator;", true);
|
mv.visitMethodInsn(INVOKEINTERFACE, "java/lang/Iterable", "iterator", "()Ljava/util/Iterator;", true);
|
||||||
var start = new Label();
|
var start = new Label();
|
||||||
var end = new Label();
|
var end = new Label();
|
||||||
|
|
||||||
var env = new BreakEnv();
|
|
||||||
env.startLabel = start;
|
|
||||||
env.endLabel = end;
|
|
||||||
|
|
||||||
mv.visitLabel(start);
|
mv.visitLabel(start);
|
||||||
mv.visitInsn(DUP);
|
mv.visitInsn(DUP);
|
||||||
mv.visitMethodInsn(INVOKEINTERFACE, "java/util/Iterator", "hasNext", "()Z", true);
|
mv.visitMethodInsn(INVOKEINTERFACE, "java/util/Iterator", "hasNext", "()Z", true);
|
||||||
@@ -1319,9 +1314,7 @@ public class Codegen {
|
|||||||
mv.visitTypeInsn(CHECKCAST, localVar.type().getInternalName());
|
mv.visitTypeInsn(CHECKCAST, localVar.type().getInternalName());
|
||||||
mv.visitVarInsn(ASTORE, localVar.index);
|
mv.visitVarInsn(ASTORE, localVar.index);
|
||||||
|
|
||||||
state.breakStack.push(env);
|
|
||||||
generate(state, forEach.body());
|
generate(state, forEach.body());
|
||||||
state.breakStack.pop();
|
|
||||||
|
|
||||||
mv.visitJumpInsn(GOTO, start);
|
mv.visitJumpInsn(GOTO, start);
|
||||||
mv.visitLabel(end);
|
mv.visitLabel(end);
|
||||||
|
|||||||
@@ -1808,10 +1808,9 @@ public class TestComplete {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testBug458() throws Exception {
|
public void testBug466() throws Exception {
|
||||||
var classFiles = generateClassFiles(createClassLoader(), "Bug458.jav");
|
var classFiles = generateClassFiles(createClassLoader(), "Bug466.jav");
|
||||||
var clazz = classFiles.get("Bug458");
|
var clazz = classFiles.get("Bug466");
|
||||||
var main = clazz.getDeclaredMethod("main", List.class);
|
clazz.getDeclaredMethod("main", List.class).invoke(null, List.of());
|
||||||
main.invoke(null, List.of());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user