diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/operations/SubtractTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/operations/SubtractTreeItem.java index 126338e5e..8355ea2df 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/operations/SubtractTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/operations/SubtractTreeItem.java @@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.abc.avm2.treemodel.operations; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.graph.BinaryOpItem; import com.jpexs.decompiler.flash.graph.GraphTargetItem; +import java.util.List; public class SubtractTreeItem extends BinaryOpItem { @@ -30,4 +31,20 @@ public class SubtractTreeItem extends BinaryOpItem { public double toNumber() { return leftSide.toNumber() - rightSide.toNumber(); } + + @Override + public String toString(List localData) { + if (!(getLeftMostItem(rightSide) instanceof NegTreeItem)) { // a - (-b*c*d) + return super.toString(localData); + } + String ret = ""; + if (leftSide.getPrecedence() > precedence) { + ret += "(" + leftSide.toString(localData) + ")"; + } else { + ret += leftSide.toString(localData); + } + ret += hilight(operator); + ret += "(" + rightSide.toString(localData) + ")"; + return ret; + } } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/TraitClass.java b/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/TraitClass.java index d66def457..457c5d07a 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/TraitClass.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/TraitClass.java @@ -124,7 +124,7 @@ public class TraitClass extends Trait implements TraitWithSlot { } } if (ns.kind == Namespace.KIND_NAMESPACE) { - if(!usname.equals("*")){ + if (!usname.equals("*")) { if (!uses.contains(usname)) { uses.add(usname); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/SubtractTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/SubtractTreeItem.java index 8a53b6b00..ba9916a99 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/SubtractTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/operations/SubtractTreeItem.java @@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.action.treemodel.operations; import com.jpexs.decompiler.flash.graph.BinaryOpItem; import com.jpexs.decompiler.flash.graph.GraphSourceItem; import com.jpexs.decompiler.flash.graph.GraphTargetItem; +import java.util.List; public class SubtractTreeItem extends BinaryOpItem { @@ -30,4 +31,20 @@ public class SubtractTreeItem extends BinaryOpItem { public double toNumber() { return leftSide.toNumber() - rightSide.toNumber(); } + + @Override + public String toString(List localData) { + if (!(getLeftMostItem(rightSide) instanceof NegTreeItem)) { // a - (-b*c*d) + return super.toString(localData); + } + String ret = ""; + if (leftSide.getPrecedence() > precedence) { + ret += "(" + leftSide.toString(localData) + ")"; + } else { + ret += leftSide.toString(localData); + } + ret += hilight(operator); + ret += "(" + rightSide.toString(localData) + ")"; + return ret; + } } diff --git a/trunk/src/com/jpexs/decompiler/flash/graph/BinaryOpItem.java b/trunk/src/com/jpexs/decompiler/flash/graph/BinaryOpItem.java index be075b31b..e737424ca 100644 --- a/trunk/src/com/jpexs/decompiler/flash/graph/BinaryOpItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/graph/BinaryOpItem.java @@ -90,6 +90,22 @@ public abstract class BinaryOpItem extends GraphTargetItem { return hash; } + public GraphTargetItem getLeftMostItem(GraphTargetItem item) { + GraphTargetItem ret = item; + if (ret instanceof BinaryOpItem) { + ret = ((BinaryOpItem) ret).getLeftMostItem(); + } + return ret; + } + + public GraphTargetItem getLeftMostItem() { + GraphTargetItem ret = leftSide; + if (ret instanceof BinaryOpItem) { + ret = ((BinaryOpItem) ret).getLeftMostItem(); + } + return ret; + } + @Override public boolean equals(Object obj) { if (obj == null) {