fix AND Logical Operation

This commit is contained in:
simon 2024-06-28 21:57:19 +02:00
parent 133e7824ba
commit 354502cc20

View File

@ -3,17 +3,14 @@ package de.maishai.typedast.typedclass;
import de.maishai.ast.Operator; import de.maishai.ast.Operator;
import de.maishai.ast.records.Binary; import de.maishai.ast.records.Binary;
import de.maishai.typedast.MethodContext; import de.maishai.typedast.MethodContext;
import de.maishai.typedast.TypedExpression;
import de.maishai.typedast.Type; import de.maishai.typedast.Type;
import de.maishai.typedast.TypedExpression;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import org.objectweb.asm.Label; import org.objectweb.asm.Label;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes; import org.objectweb.asm.Opcodes;
import java.util.Map;
import static de.maishai.typedast.Help.TypedExpressionHelp.convertExpression; import static de.maishai.typedast.Help.TypedExpressionHelp.convertExpression;
@Data @Data
@ -78,9 +75,9 @@ public class TypedBinary implements TypedExpression {
Label returnTrue = new Label(); Label returnTrue = new Label();
Label returnFalse = new Label(); Label returnFalse = new Label();
left.codeGen(ctx); left.codeGen(ctx);
ctx.getMv().visitJumpInsn(Opcodes.IFNE, returnFalse); ctx.getMv().visitJumpInsn(Opcodes.IFEQ, returnFalse);
right.codeGen(ctx); right.codeGen(ctx);
ctx.getMv().visitJumpInsn(Opcodes.IFNE, returnFalse); ctx.getMv().visitJumpInsn(Opcodes.IFEQ, returnFalse);
ctx.getMv().visitJumpInsn(Opcodes.GOTO, returnTrue); ctx.getMv().visitJumpInsn(Opcodes.GOTO, returnTrue);
ctx.getMv().visitLabel(returnFalse); ctx.getMv().visitLabel(returnFalse);