diff --git a/CHANGELOG.md b/CHANGELOG.md index 77c991721..b7e173329 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,9 @@ All notable changes to this project will be documented in this file. ### Added - #1202 Check for modifications outside FFDec and ask user to reload +### Fixed +- #1298 AS1/2 properly decompiled setProperty/getProperty + ## [13.0.3] - 2021-02-12 ### Added - #1594 Option to disable AS3 P-code indentation, label on separate line diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/GetPropertyActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/GetPropertyActionItem.java index c64e9dfeb..c6e16b085 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/GetPropertyActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/GetPropertyActionItem.java @@ -12,7 +12,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. */ + * License along with this library. + */ package com.jpexs.decompiler.flash.action.model; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; @@ -56,11 +57,6 @@ public class GetPropertyActionItem extends ActionItem { return writer.append(Action.propertyNames[propertyIndex]); } - if ((target instanceof DirectValueActionItem) && ((DirectValueActionItem) target).isString()) { - target.toStringNoQuotes(writer, localData); - return writer.append(":" + Action.propertyNames[propertyIndex]); - } - writer.append("getProperty"); writer.spaceBeforeCallParenthesies(2); writer.append("("); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/SetPropertyActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/SetPropertyActionItem.java index 75543d564..33f723937 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/SetPropertyActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/SetPropertyActionItem.java @@ -12,7 +12,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. */ + * License along with this library. + */ package com.jpexs.decompiler.flash.action.model; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; @@ -82,12 +83,6 @@ public class SetPropertyActionItem extends ActionItem implements SetTypeActionIt return value.toString(writer, localData); } - if ((target instanceof DirectValueActionItem) && ((DirectValueActionItem) target).isString()) { - target.toStringNoQuotes(writer, localData); - writer.append(":" + Action.propertyNames[propertyIndex]).append(" = "); - return value.toString(writer, localData); - } - writer.append("setProperty"); writer.spaceBeforeCallParenthesies(3); writer.append("("); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf4/ActionSetProperty.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf4/ActionSetProperty.java index b9a48ab06..51d59e804 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf4/ActionSetProperty.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf4/ActionSetProperty.java @@ -12,7 +12,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. */ + * License along with this library. + */ package com.jpexs.decompiler.flash.action.swf4; import com.jpexs.decompiler.flash.BaseLocalData; @@ -84,50 +85,7 @@ public class ActionSetProperty extends Action { indexInt = (int) Math.round((Float) ((DirectValueActionItem) index).value); } } - if (value.getThroughDuplicate() instanceof IncrementActionItem) { - GraphTargetItem obj = ((IncrementActionItem) value).object; - if (!stack.isEmpty() && stack.peek().valueEquals(obj)) { - stack.pop(); - stack.push(new PostIncrementActionItem(this, lineStartAction, obj)); - return; - } - } - if (value.getThroughDuplicate() instanceof DecrementActionItem) { - GraphTargetItem obj = ((DecrementActionItem) value).object; - if (!stack.isEmpty() && stack.peek().valueEquals(obj)) { - stack.pop(); - stack.push(new PostDecrementActionItem(this, lineStartAction, obj)); - return; - } - } - GraphTargetItem ret = new SetPropertyActionItem(this, lineStartAction, target, indexInt, value); - - if (value instanceof StoreRegisterActionItem) { - StoreRegisterActionItem sr = (StoreRegisterActionItem) value; - if (sr.define) { - value = sr.getValue(); - ((SetPropertyActionItem) ret).setValue(value); - if (value instanceof IncrementActionItem) { - if (((IncrementActionItem) value).object instanceof GetPropertyActionItem) { - if (((GetPropertyActionItem) ((IncrementActionItem) value).object).valueEquals(((SetPropertyActionItem) ret).getObject())) { - ret = new PreIncrementActionItem(this, lineStartAction, ((IncrementActionItem) value).object); - } - } - } else if (value instanceof DecrementActionItem) { - if (((DecrementActionItem) value).object instanceof GetPropertyActionItem) { - if (((GetPropertyActionItem) ((DecrementActionItem) value).object).valueEquals(((SetPropertyActionItem) ret).getObject())) { - ret = new PreDecrementActionItem(this, lineStartAction, ((DecrementActionItem) value).object); - } - } - } else { - sr.temporary = true; - ((SetPropertyActionItem) ret).setValue(sr); - } - variables.put("__register" + sr.register.number, new TemporaryRegister(sr.register.number, ret)); - return; - } - } output.add(ret); }