diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/NameValuePair.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/NameValuePair.java index 05223e95c..8b8e0d0ef 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/NameValuePair.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/NameValuePair.java @@ -18,6 +18,7 @@ package com.jpexs.decompiler.flash.abc.avm2.treemodel; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.graph.GraphTargetItem; +import com.jpexs.decompiler.flash.graph.TernarOpItem; import java.util.HashMap; import java.util.List; @@ -34,6 +35,10 @@ public class NameValuePair extends TreeItem { @Override public String toString(ConstantPool constants, HashMap localRegNames, List fullyQualifiedNames) { - return name.toString(constants, localRegNames, fullyQualifiedNames) + ":" + value.toString(constants, localRegNames, fullyQualifiedNames); + String valueStr = value.toString(constants, localRegNames, fullyQualifiedNames); + if (value instanceof TernarOpItem) { //Ternar operator contains ":" + valueStr = "(" + valueStr + ")"; + } + return name.toString(constants, localRegNames, fullyQualifiedNames) + ":" + valueStr; } } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/clauses/TernarOpTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/clauses/TernarOpTreeItem.java deleted file mode 100644 index fa2182e18..000000000 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/clauses/TernarOpTreeItem.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (C) 2010-2013 JPEXS - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package com.jpexs.decompiler.flash.abc.avm2.treemodel.clauses; - -import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; -import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.decompiler.flash.abc.avm2.treemodel.TreeItem; -import com.jpexs.decompiler.flash.graph.GraphTargetItem; -import java.util.HashMap; -import java.util.List; - -public class TernarOpTreeItem extends TreeItem { - - public GraphTargetItem expression; - public GraphTargetItem onTrue; - public GraphTargetItem onFalse; - - public TernarOpTreeItem(AVM2Instruction instruction, GraphTargetItem expression, GraphTargetItem onTrue, GraphTargetItem onFalse) { - super(instruction, PRECEDENCE_CONDITIONAL); - this.expression = expression; - this.onTrue = onTrue; - this.onFalse = onFalse; - } - - @Override - public String toString(ConstantPool constants, HashMap localRegNames, List fullyQualifiedNames) { - return expression.toString(constants, localRegNames, fullyQualifiedNames) + hilight("?") + onTrue.toString(constants, localRegNames, fullyQualifiedNames) + hilight(":") + onFalse.toString(constants, localRegNames, fullyQualifiedNames); - } -} diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/InitObjectTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/InitObjectTreeItem.java index 4ea587af9..ab9dd7526 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/InitObjectTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/InitObjectTreeItem.java @@ -18,6 +18,7 @@ package com.jpexs.decompiler.flash.action.treemodel; import com.jpexs.decompiler.flash.graph.GraphSourceItem; import com.jpexs.decompiler.flash.graph.GraphTargetItem; +import com.jpexs.decompiler.flash.graph.TernarOpItem; import java.util.List; public class InitObjectTreeItem extends TreeItem { @@ -38,7 +39,11 @@ public class InitObjectTreeItem extends TreeItem { if (i > 0) { objStr += hilight(","); } - objStr += names.get(i).toString(constants) + hilight(":") + values.get(i).toString(constants); + String valueStr = values.get(i).toString(constants); + if (values.get(i) instanceof TernarOpItem) { //Ternar operator contains ":" + valueStr = "(" + valueStr + ")"; + } + objStr += names.get(i).toString(constants) + hilight(":") + valueStr; } return hilight("{") + objStr + hilight("}"); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/clauses/TernarOpTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/clauses/TernarOpTreeItem.java deleted file mode 100644 index 405c74198..000000000 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/clauses/TernarOpTreeItem.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2010-2013 JPEXS - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package com.jpexs.decompiler.flash.action.treemodel.clauses; - -import com.jpexs.decompiler.flash.action.Action; -import com.jpexs.decompiler.flash.action.treemodel.ConstantPool; -import com.jpexs.decompiler.flash.action.treemodel.TreeItem; - -public class TernarOpTreeItem extends TreeItem { - - public TreeItem expression; - public TreeItem onTrue; - public TreeItem onFalse; - - public TernarOpTreeItem(Action instruction, TreeItem expression, TreeItem onTrue, TreeItem onFalse) { - super(instruction, PRECEDENCE_CONDITIONAL); - this.expression = expression; - this.onTrue = onTrue; - this.onFalse = onFalse; - } - - @Override - public String toString(ConstantPool constants) { - return expression.toString(constants) + hilight("?") + onTrue.toString(constants) + hilight(":") + onFalse.toString(constants); - } -}