diff --git a/CHANGELOG.md b/CHANGELOG.md index 3050e7a6f..e257100bc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ All notable changes to this project will be documented in this file. - [#2094] AS3 missing star type on var and const - [#2094] AS3 Getting register names from debug info - do not allow assigning `_locX_` name to other register than X - [#2094] Embed font name taken from the fontTag, not DefineFontName +- AS3 Simplify expressions - Do not convert this to {} when coerced ## [19.0.0] - 2023-10-01 ### Added diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/CoerceAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/CoerceAVM2Item.java index 9f693485c..22a52d7a2 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/CoerceAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/CoerceAVM2Item.java @@ -127,7 +127,15 @@ public class CoerceAVM2Item extends AVM2Item { return false; } dependencies.add(value); - return value.isConvertedCompileTime(dependencies); + switch(typeObj.toString()) { + case "String": + case "Boolean": + case "int": + case "uint": + case "Number": + return value.isConvertedCompileTime(dependencies); + } + return false; } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/ecma/ObjectType.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/ecma/ObjectType.java index 4d14932f4..4e38df73f 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/ecma/ObjectType.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/ecma/ObjectType.java @@ -31,7 +31,7 @@ public class ObjectType implements Callable { public static final ObjectType EMPTY_OBJECT = new ObjectType(); protected Map attributes; - + public void setAttribute(String name, Object value) { attributes.put(name, value); } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/GraphTargetItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/GraphTargetItem.java index 600a33601..5f7013e6d 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/GraphTargetItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/GraphTargetItem.java @@ -180,7 +180,7 @@ public abstract class GraphTargetItem implements Serializable, Cloneable { case "Boolean": r = EcmaScript.toBoolean(r); break; - } + } GraphTargetItem it2 = valToItem(r); if (it2 == null) {