diff --git a/src/main/java/de/maishai/typedast/typedclass/TypedMethod.java b/src/main/java/de/maishai/typedast/typedclass/TypedMethod.java index 5a66a31..5f2ee7b 100644 --- a/src/main/java/de/maishai/typedast/typedclass/TypedMethod.java +++ b/src/main/java/de/maishai/typedast/typedclass/TypedMethod.java @@ -124,7 +124,7 @@ public class TypedMethod implements TypedNode { int accessModifier = Opcodes.ACC_PUBLIC; // ist laut Andi ok MethodVisitor mv = ctx.getCw().visitMethod(accessModifier, name, CodeGenUtils.generateDescriptor(typedParameters.stream().map(TypedParameter::getType).toList(), returnType), null, null); - MethodContext mctx = new MethodContext(ctx, mv); + MethodContext mctx = new MethodContext(ctx, mv, returnType); typedParameters.forEach(param -> mctx.registerVariable(param.getParaName(), param.getType())); typedBlock.codeGen(mctx); @@ -134,7 +134,7 @@ public class TypedMethod implements TypedNode { public void codeGenMain(ClassContext ctx) { MethodVisitor mv = ctx.getCw().visitMethod(Opcodes.ACC_PUBLIC + Opcodes.ACC_STATIC, name, "([Ljava/lang/String;)V", null, null); - MethodContext mctx = new MethodContext(ctx, mv); + MethodContext mctx = new MethodContext(ctx, mv, returnType); typedParameters.forEach(param -> mctx.registerVariable(param.getParaName(), param.getType())); typedBlock.codeGen(mctx);