OuterValues added

inner/anonymous classes completely reworked
use getSubExpressions()[0] instead of getLValue()


git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@1193 379699f6-c40d-0410-875b-85095c16579e
branch_1_1
jochen 26 years ago
parent 38a01116c1
commit 8fc12f679e
  1. 22
      jode/jode/flow/CreateAssignExpression.java
  2. 9
      jode/jode/flow/CreatePrePostIncExpression.java
  3. 1
      jode/jode/flow/FlowBlock.java.in
  4. 1464
      jode/jode/flow/TransformConstructors.java

@ -58,14 +58,15 @@ public class CreateAssignExpression {
StoreInstruction store = (StoreInstruction) ic.getInstruction();
if (!store.isFreeOperator())
return false;
int lvalueCount = store.getLValue().getFreeOperandCount();
Expression lvalue = store.getSubExpressions()[0];
int lvalueCount = lvalue.getFreeOperandCount();
boolean isAssignOp = false;
if (opBlock.subBlocks[0] instanceof SpecialBlock) {
SpecialBlock dup = (SpecialBlock) opBlock.subBlocks[0];
if (dup.type != SpecialBlock.DUP
|| dup.depth != lvalueCount
|| dup.count != store.getLValue().getType().stackSize()
|| dup.count != lvalue.getType().stackSize()
|| !(opBlock.outer instanceof SequentialBlock))
return false;
opBlock = (SequentialBlock) opBlock.outer;
@ -102,7 +103,7 @@ public class CreateAssignExpression {
if (expr instanceof ConvertOperator
&& expr.getSubExpressions()[0] instanceof Operator
&& expr.getType().isOfType(store.getLValue().getType())) {
&& expr.getType().isOfType(lvalue.getType())) {
/* This gets tricky. We need to allow something like
* s = (short) (int) ((double) s / 0.1);
@ -129,9 +130,9 @@ public class CreateAssignExpression {
|| !(loadExpr.isFreeOperator(lvalueCount)))
return false;
if (store.getLValue() instanceof LocalStoreOperator)
if (lvalue instanceof LocalStoreOperator)
((LocalLoadOperator)loadExpr).getLocalInfo().combineWith
(((LocalStoreOperator)store.getLValue()).getLocalInfo());
(((LocalStoreOperator)lvalue).getLocalInfo());
rightHandSide = expr.getSubExpressions()[1];
} else {
@ -159,9 +160,9 @@ public class CreateAssignExpression {
|| !(((Operator) simple).isFreeOperator(lvalueCount)))
return false;
if (store.getLValue() instanceof LocalStoreOperator)
if (lvalue instanceof LocalStoreOperator)
((LocalLoadOperator)simple).getLocalInfo().combineWith
(((LocalStoreOperator)store.getLValue()).getLocalInfo());
(((LocalStoreOperator)lvalue).getLocalInfo());
/* ... and remove it. */
if (parent != null) {
@ -177,7 +178,7 @@ public class CreateAssignExpression {
dup.removeBlock();
ib.setInstruction(rightHandSide);
store.getLValue().setType(rvalueType);
lvalue.setType(rvalueType);
store.makeOpAssign(store.OPASSIGN_OP + opIndex);
if (isAssignOp)
@ -199,10 +200,11 @@ public class CreateAssignExpression {
if (sequBlock.subBlocks[0] instanceof SpecialBlock
&& store.isFreeOperator()) {
Expression lvalue = store.getSubExpressions()[0];
SpecialBlock dup = (SpecialBlock) sequBlock.subBlocks[0];
if (dup.type != SpecialBlock.DUP
|| dup.depth != store.getLValue().getFreeOperandCount()
|| dup.count != store.getLValue().getType().stackSize())
|| dup.depth != lvalue.getFreeOperandCount()
|| dup.count != lvalue.getType().stackSize())
return false;
dup.removeBlock();

@ -113,8 +113,9 @@ public class CreatePrePostIncExpression {
* not yet resolved (and note that the rvalue part
* should also have 1 remaining operand)
*/
int lvalueCount = store.getLValue().getFreeOperandCount();
if (!store.getLValue().isFreeOperator()
Expression lvalue = store.getSubExpressions()[0];
int lvalueCount = lvalue.getFreeOperandCount();
if (!((Operator)lvalue).isFreeOperator()
|| !store.isVoid()
|| !(store.getSubExpressions()[1] instanceof BinaryOperator))
return false;
@ -148,7 +149,7 @@ public class CreatePrePostIncExpression {
SpecialBlock dup = (SpecialBlock) sb.subBlocks[0];
if (dup.type != SpecialBlock.DUP
|| dup.count != store.getLValue().getType().stackSize()
|| dup.count != lvalue.getType().stackSize()
|| dup.depth != lvalueCount)
return false;
@ -176,7 +177,7 @@ public class CreatePrePostIncExpression {
return false;
}
ic.setInstruction
(new PrePostFixOperator(store.getLValue().getType(), op,
(new PrePostFixOperator(lvalue.getType(), op,
store.getLValue(), true));
ic.moveDefinitions(sb, last);
last.replace(sb);

@ -1743,4 +1743,3 @@ public class FlowBlock {
}
}
}

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save