Fixed MethodCall
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run

This commit is contained in:
i22007 2024-07-04 21:03:52 -04:00
parent 3628a0a4d8
commit 0de5c3e993

View File

@ -458,7 +458,7 @@ public class MethodCodeGen implements bytecode.visitor.MethodVisitor {
AssignableNode assignableNode = incrementNode.assignableExpression; AssignableNode assignableNode = incrementNode.assignableExpression;
if (assignableNode.memberAccess != null) { if (assignableNode.memberAccess != null) {
assignableNode.memberAccess.accept(this); assignableNode.memberAccess.accept(this);
} else { // TODO: typeNode incrementNode.assignableExpression = null, erledigt } else {
if (assignableNode.typeNode instanceof BaseType) { if (assignableNode.typeNode instanceof BaseType) {
methodVisitor.visitVarInsn(ILOAD, localVariables.indexOf(assignableNode.identifier)); methodVisitor.visitVarInsn(ILOAD, localVariables.indexOf(assignableNode.identifier));
} else if (assignableNode.typeNode instanceof ReferenceType) { } else if (assignableNode.typeNode instanceof ReferenceType) {
@ -471,7 +471,7 @@ public class MethodCodeGen implements bytecode.visitor.MethodVisitor {
AssignableNode assignableNode = decrementNode.assignableExpression; AssignableNode assignableNode = decrementNode.assignableExpression;
if (assignableNode.memberAccess != null) { if (assignableNode.memberAccess != null) {
assignableNode.memberAccess.accept(this); assignableNode.memberAccess.accept(this);
} else { // TODO: typeNode decrementNode.assignableExpression = null, erledigt } else {
if (assignableNode.typeNode instanceof BaseType) { if (assignableNode.typeNode instanceof BaseType) {
methodVisitor.visitVarInsn(ILOAD, localVariables.indexOf(assignableNode.identifier)); methodVisitor.visitVarInsn(ILOAD, localVariables.indexOf(assignableNode.identifier));
} else if (assignableNode.typeNode instanceof ReferenceType) { } else if (assignableNode.typeNode instanceof ReferenceType) {
@ -727,6 +727,18 @@ 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(), ""));
} }
int localVarIndex = -1;
if (methodCallNode.target.memberAccess.identifiers.size() > 1) {
localVarIndex = localVariables.indexOf(methodCallNode.target.memberAccess.identifiers.get(1)); // TODO
}
if (localVarIndex >= 0) { // local var object
methodVisitor.visitVarInsn(ALOAD, localVarIndex);
} else { // this field
methodVisitor.visitVarInsn(ALOAD, 0);
}
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);
} }
} }