From e1e1f3eafc344c13c38fb8527158c18340fc2604 Mon Sep 17 00:00:00 2001 From: Daniel Holle Date: Mon, 26 Jun 2023 13:14:53 +0200 Subject: [PATCH] Insert missing case --- src/main/java/de/dhbwstuttgart/bytecode/Codegen.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/main/java/de/dhbwstuttgart/bytecode/Codegen.java b/src/main/java/de/dhbwstuttgart/bytecode/Codegen.java index 29699d83..16837e50 100644 --- a/src/main/java/de/dhbwstuttgart/bytecode/Codegen.java +++ b/src/main/java/de/dhbwstuttgart/bytecode/Codegen.java @@ -782,6 +782,18 @@ public class Codegen { break; } break; + case TargetVarDecl varDecl: { + var local = state.createVariable(varDecl.name(), varDecl.varType()); + if (varDecl.value() != null) { + generate(state, varDecl.value()); + boxPrimitive(state, varDecl.varType()); + mv.visitVarInsn(ASTORE, local.index()); + } else { + mv.visitInsn(ACONST_NULL); + mv.visitVarInsn(ASTORE, local.index()); + } + break; + } case TargetBinaryOp op: generateBinaryOp(state, op); break;