Skip to content

Commit

Permalink
fix: loop expression validation
Browse files Browse the repository at this point in the history
  • Loading branch information
Eddie authored and Eddie committed Jun 19, 2024
1 parent 21dabbd commit 493db11
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/main/java/com/jungle/compiler/visitor/LoopVisitor.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,7 @@ public void visit(
// loop-condition
mv.visitLabel(loopLabel);
getExpressionVisitor().visit(mv, ast.getLeft(), context);
if (context.peek() != OperandType.INTEGER) {
// TODO: shouldn't this be testing for boolean?
if (!OperandType.INTEGER_COMPUTATIONAL_TYPES.contains(context.peek())) {
throw new Error("loop condition/expression expected to be type integer");
}
mv.visitJumpInsn(Opcodes.IFEQ, endLabel);
Expand Down

0 comments on commit 493db11

Please sign in to comment.