Endabgabe #20

Merged
i22035 merged 137 commits from Endabgabe into main 2024-07-05 11:59:47 +00:00
Showing only changes of commit 3fb11e5d7e - Show all commits

View File

@ -267,7 +267,7 @@ public class MethodCodeGen implements bytecode.visitor.MethodVisitor {
@Override
public void visit(MemberAccessNode memberAccessNode) {
// Only used to get, not to put
int localVarIndex = localVariables.indexOf("memberAccessNode.identifier"); // TODO: Anführungszeichen entfernen
int localVarIndex = localVariables.indexOf("memberAccessNode.identifier"); // TODO
if (localVarIndex >= 0) { // local var object
methodVisitor.visitVarInsn(ALOAD, localVarIndex);
} else { // this field
@ -723,10 +723,6 @@ public class MethodCodeGen implements bytecode.visitor.MethodVisitor {
@Override
public void visit(MethodCallNode methodCallNode) {
List<ParameterNode> parameterNodes = new ArrayList<>();
for (IExpressionNode expressionNode : methodCallNode.parameters) {
expressionNode.accept(this);
parameterNodes.add(new ParameterNode(expressionNode.getType(), ""));
}
int localVarIndex = -1;
if (methodCallNode.target.memberAccess.identifiers.size() > 1) {
localVarIndex = localVariables.indexOf(methodCallNode.target.memberAccess.identifiers.get(1));
@ -736,8 +732,9 @@ public class MethodCodeGen implements bytecode.visitor.MethodVisitor {
} else { // this field
methodVisitor.visitVarInsn(ALOAD, 0);
}
if (methodCallNode.type == null) {
methodCallNode.type = new BaseType(TypeEnum.INT);
for (IExpressionNode expressionNode : methodCallNode.parameters) {
expressionNode.accept(this);
parameterNodes.add(new ParameterNode(expressionNode.getType(), ""));
}
methodVisitor.visitMethodInsn(INVOKEVIRTUAL, methodCallNode.target.memberAccess.identifiers.get(0), methodCallNode.identifier, mapper.generateMethodDescriptor(methodCallNode.type, parameterNodes), false);
}