Merge remote-tracking branch 'origin/Endabgabe' into Endabgabe
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run

# Conflicts:
#	src/main/java/bytecode/MethodCodeGen.java
This commit is contained in:
Maximilian Stahl 2024-07-05 13:23:57 +02:00
commit 3de54afa93

View File

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