mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-08 06:55:05 +00:00
Fixed #1298 AS1/2 properly decompiled setProperty/getProperty
This commit is contained in:
@@ -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("(");
|
||||
|
||||
@@ -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("(");
|
||||
|
||||
@@ -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);
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user