mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-01 10:55:12 +00:00
Issue #178 AS Subtract with negate fixed
This commit is contained in:
@@ -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<Object> 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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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<Object> 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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user