BinaryTest funktioniert
This commit is contained in:
parent
5d0603f423
commit
dd8b4f322e
@ -69,6 +69,10 @@ public class BytecodeGenMethod implements StatementVisitor {
|
||||
private SourceFile sf;
|
||||
private IStatement statement = null;
|
||||
|
||||
private boolean returnParentOfUnary = false;
|
||||
// speichert, ob der Argument RefType ist.
|
||||
private List<Boolean> argList = new LinkedList<>();
|
||||
|
||||
// private int numMethodCalls = 0;
|
||||
|
||||
// for tests **
|
||||
@ -273,10 +277,6 @@ public class BytecodeGenMethod implements StatementVisitor {
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Diese Methode wird nicht mehr gebraucht, da es jetzt nicht möglich ist, dass
|
||||
* solche Fälle: Integer -> Integer (OP) Short ,... usw, nicht vorkommen!
|
||||
*/
|
||||
private String getLargerType(String lexpType, String rexpType) {
|
||||
if (lexpType.equals(Type.getInternalName(String.class))
|
||||
|| rexpType.equals(Type.getInternalName(String.class))) {
|
||||
@ -713,6 +713,10 @@ public class BytecodeGenMethod implements StatementVisitor {
|
||||
String mDesc = "";
|
||||
List<Boolean> argListMethCall = new LinkedList<>();
|
||||
if(methodRefl == null) {
|
||||
// Alle Argumente sind nicht Primitiv
|
||||
for(Expression arg : methodCall.arglist.getArguments()) {
|
||||
argList.add(true);
|
||||
}
|
||||
MethodFromMethodCall method = new MethodFromMethodCall(methodCall.arglist, methodCall.getType(),
|
||||
receiverName, genericsAndBoundsMethod, genericsAndBounds);
|
||||
mDesc = method.accept(new DescriptorToString(resultSet));
|
||||
@ -864,10 +868,13 @@ public class BytecodeGenMethod implements StatementVisitor {
|
||||
// Für Byte und Short muss noch einen Cast geben i2b, i2s
|
||||
// das wird später gemacht, da bytecode für cast noch nicht erzeugt wird
|
||||
|
||||
if (isIncOrDec && (unaryExpr.expr instanceof LocalVar)) {
|
||||
if (isIncOrDec && (unaryExpr.expr instanceof LocalVar) && !returnParentOfUnary) {
|
||||
LocalVar local = (LocalVar) unaryExpr.expr;
|
||||
mv.visitVarInsn(Opcodes.ASTORE, paramsAndLocals.get(local.name));
|
||||
}
|
||||
|
||||
if(returnParentOfUnary)
|
||||
returnParentOfUnary = false;
|
||||
}
|
||||
|
||||
private void doVisitNegIns(String typeOfUnary) {
|
||||
@ -913,7 +920,10 @@ public class BytecodeGenMethod implements StatementVisitor {
|
||||
public void visit(Return aReturn) {
|
||||
statement = new ReturnStmt(aReturn.retexpr);
|
||||
isBinaryExp = statement.isExprBinary();
|
||||
|
||||
|
||||
if(aReturn.retexpr instanceof UnaryExpr)
|
||||
returnParentOfUnary = true;
|
||||
|
||||
aReturn.retexpr.accept(this);
|
||||
|
||||
if (isBinaryExp) {
|
||||
@ -1173,7 +1183,15 @@ public class BytecodeGenMethod implements StatementVisitor {
|
||||
public void visit(ArgumentList argumentList) {
|
||||
for (Expression al : argumentList.getArguments()) {
|
||||
statement = new ArgumentExpr(al);
|
||||
isBinaryExp = statement.isExprBinary();
|
||||
al.accept(this);
|
||||
//TODO: teste, ob man das für unary braucht
|
||||
if (isBinaryExp) {
|
||||
BinaryExpr binary = (BinaryExpr) al;
|
||||
String binaryType = getResolvedType(binary.getType());
|
||||
doBoxing(binaryType);
|
||||
isBinaryExp = false;
|
||||
}
|
||||
statement = null;
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +0,0 @@
|
||||
public class PTGen {
|
||||
m(List<E> list) {
|
||||
return list;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user