InvokeOperator has new constructor syntax

Const/IInc-Operator.getValue() changed return type.


git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@1184 379699f6-c40d-0410-875b-85095c16579e
branch_1_1
jochen 25 years ago
parent 75f42b3167
commit e00cff956c
  1. 4
      jode/jode/flow/CreateClassField.java
  2. 8
      jode/jode/flow/CreateConstantArray.java
  3. 2
      jode/jode/flow/CreateIfThenElseOperator.java
  4. 4
      jode/jode/flow/CreateNewConstructor.java
  5. 11
      jode/jode/flow/CreatePrePostIncExpression.java

@ -67,8 +67,8 @@ public class CreateClassField {
if (invoke.isGetClass() if (invoke.isGetClass()
&& param instanceof ConstOperator && param instanceof ConstOperator
&& param.getType().equals(Type.tString)) { && ((ConstOperator)param).getValue() instanceof String) {
String clazz = ((ConstOperator)param).getValue(); String clazz = (String) ((ConstOperator)param).getValue();
if (put.getField().setClassConstant(clazz)) { if (put.getField().setClassConstant(clazz)) {
cmp.setSubExpressions cmp.setSubExpressions
(0, new ClassFieldOperator(clazz.charAt(0) == '[' (0, new ClassFieldOperator(clazz.charAt(0) == '['

@ -61,11 +61,11 @@ public class CreateConstantArray {
if (dup.type != SpecialBlock.DUP if (dup.type != SpecialBlock.DUP
|| dup.depth != 0 || dup.count != 1 || dup.depth != 0 || dup.count != 1
|| !(indexOp.getType().isOfType(Type.tUInt)) || !(indexOp.getValue() instanceof Integer)
|| !(sequBlock.subBlocks[0] instanceof InstructionBlock)) || !(sequBlock.subBlocks[0] instanceof InstructionBlock))
return false; return false;
int index = Integer.parseInt(indexOp.getValue()); int index = ((Integer) indexOp.getValue()).intValue();
InstructionBlock ib = (InstructionBlock)sequBlock.subBlocks[0]; InstructionBlock ib = (InstructionBlock)sequBlock.subBlocks[0];
if (ib.getInstruction() instanceof NewArrayOperator) { if (ib.getInstruction() instanceof NewArrayOperator) {
@ -79,10 +79,10 @@ public class CreateConstantArray {
ConstOperator countop = ConstOperator countop =
(ConstOperator) newArray.getSubExpressions()[0]; (ConstOperator) newArray.getSubExpressions()[0];
if (!countop.getType().isOfType(Type.tUInt)) if (!(countop.getValue() instanceof Integer))
return false; return false;
int arraylength = Integer.parseInt(countop.getValue()); int arraylength = ((Integer) countop.getValue()).intValue();
if (arraylength <= index) if (arraylength <= index)
return false; return false;

@ -96,7 +96,7 @@ public class CreateIfThenElseOperator {
(ConstOperator) pushBlock.getInstruction(); (ConstOperator) pushBlock.getInstruction();
if (condBlock.trueBlock.jump.destination == trueDest if (condBlock.trueBlock.jump.destination == trueDest
&& constOp.getValue().equals("0")) { && constOp.getValue().equals(new Integer(0))) {
Expression cond = condBlock.getInstruction(); Expression cond = condBlock.getInstruction();
condBlock.flowBlock.removeSuccessor(condBlock.trueBlock.jump); condBlock.flowBlock.removeSuccessor(condBlock.trueBlock.jump);

@ -87,14 +87,14 @@ public class CreateNewConstructor {
Type appendType = appendCall.getMethodType().getParameterTypes()[0]; Type appendType = appendCall.getMethodType().getParameterTypes()[0];
if (!appendType.equals(Type.tString)) { if (!appendType.equals(Type.tString)) {
InvokeOperator valueOf = new InvokeOperator InvokeOperator valueOf = new InvokeOperator
(methodAna, true, false, (methodAna, InvokeOperator.STATIC,
Reference.getReference("Ljava/lang/String;", "valueOf", Reference.getReference("Ljava/lang/String;", "valueOf",
"(" + appendType.getTypeSignature() "(" + appendType.getTypeSignature()
+ ")Ljava/lang/String;")); + ")Ljava/lang/String;"));
expr = valueOf.addOperand(expr); expr = valueOf.addOperand(expr);
} }
InvokeOperator newConstr = new InvokeOperator InvokeOperator newConstr = new InvokeOperator
(methodAna, false, true, (methodAna, InvokeOperator.CONSTRUCTOR,
Reference.getReference("Ljava/lang/StringBuffer;", "<init>", Reference.getReference("Ljava/lang/StringBuffer;", "<init>",
"(Ljava/lang/String;)V")); "(Ljava/lang/String;)V"));
newConstr.makeNonVoid(); newConstr.makeNonVoid();

@ -72,9 +72,9 @@ public class CreatePrePostIncExpression {
else else
return false; return false;
if (iinc.getValue().equals("-1")) if (iinc.getValue() == -1)
op ^= 1; op ^= 1;
else if (!iinc.getValue().equals("1")) else if (iinc.getValue() != 1)
return false; return false;
if (!iinc.lvalueMatches(load)) if (!iinc.lvalueMatches(load))
@ -134,11 +134,10 @@ public class CreatePrePostIncExpression {
else else
return false; return false;
if (constOp.getValue().equals("-1") /* Why doubleValue? This is the most exact measurement. */
|| constOp.getValue().equals("-1.0")) if (((Number)constOp.getValue()).doubleValue() == -1.0)
op ^= 1; op ^= 1;
else if (!constOp.getValue().equals("1") else if (((Number)constOp.getValue()).doubleValue() != 1.0)
&& !constOp.getValue().equals("-1.0"))
return false; return false;
if (!(last.outer instanceof SequentialBlock)) if (!(last.outer instanceof SequentialBlock))

Loading…
Cancel
Save