mirror of
https://github.com/JonathanFleischmann/CompilerULTIMATE.git
synced 2024-12-28 01:18:03 +00:00
add returnType into MethodContext constructor call
This commit is contained in:
parent
724347e250
commit
b917ae594d
@ -124,7 +124,7 @@ public class TypedMethod implements TypedNode {
|
|||||||
int accessModifier = Opcodes.ACC_PUBLIC; // ist laut Andi ok
|
int accessModifier = Opcodes.ACC_PUBLIC; // ist laut Andi ok
|
||||||
MethodVisitor mv = ctx.getCw().visitMethod(accessModifier, name,
|
MethodVisitor mv = ctx.getCw().visitMethod(accessModifier, name,
|
||||||
CodeGenUtils.generateDescriptor(typedParameters.stream().map(TypedParameter::getType).toList(), returnType), null, null);
|
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()));
|
typedParameters.forEach(param -> mctx.registerVariable(param.getParaName(), param.getType()));
|
||||||
|
|
||||||
typedBlock.codeGen(mctx);
|
typedBlock.codeGen(mctx);
|
||||||
@ -134,7 +134,7 @@ public class TypedMethod implements TypedNode {
|
|||||||
public void codeGenMain(ClassContext ctx) {
|
public void codeGenMain(ClassContext ctx) {
|
||||||
MethodVisitor mv = ctx.getCw().visitMethod(Opcodes.ACC_PUBLIC + Opcodes.ACC_STATIC,
|
MethodVisitor mv = ctx.getCw().visitMethod(Opcodes.ACC_PUBLIC + Opcodes.ACC_STATIC,
|
||||||
name, "([Ljava/lang/String;)V", null, null);
|
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()));
|
typedParameters.forEach(param -> mctx.registerVariable(param.getParaName(), param.getType()));
|
||||||
|
|
||||||
typedBlock.codeGen(mctx);
|
typedBlock.codeGen(mctx);
|
||||||
|
Loading…
Reference in New Issue
Block a user