diff --git a/CHANGELOG.md b/CHANGELOG.md index c0bd7f373..cf06e7af0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ All notable changes to this project will be documented in this file. - [#1818] GFX: Importing XML - GFX: Correct refreshing image when raw editing DefineExternalImage/2, DefineSubImage - GFX: DefineExternalImage/2, DefineSubImage disallow not working replace button in favor of raw editing +- [#1795] AS3 P-code - optional (default parameter values) saving ## [16.0.4] - 2022-11-03 ### Fixed @@ -2482,6 +2483,7 @@ All notable changes to this project will be documented in this file. [#1712]: https://www.free-decompiler.com/flash/issues/1712 [#1857]: https://www.free-decompiler.com/flash/issues/1857 [#1818]: https://www.free-decompiler.com/flash/issues/1818 +[#1795]: https://www.free-decompiler.com/flash/issues/1795 [#1860]: https://www.free-decompiler.com/flash/issues/1860 [#1782]: https://www.free-decompiler.com/flash/issues/1782 [#1679]: https://www.free-decompiler.com/flash/issues/1679 diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/pcode/ASM3Parser.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/pcode/ASM3Parser.java index 5180cc8a0..d076372ac 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/pcode/ASM3Parser.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/pcode/ASM3Parser.java @@ -1230,6 +1230,8 @@ public class ASM3Parser { for (int i = 0; i < optional.size(); i++) { info.optional[i] = optional.get(i); } + } else { + info.optional = new ValueKind[0]; } abc.refreshMultinameNamespaceSuffixes(); return code; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/MethodInfo.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/MethodInfo.java index 061574416..18a0198e5 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/MethodInfo.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/MethodInfo.java @@ -342,7 +342,7 @@ public class MethodInfo { } else { writer.hilightSpecial(constants.getMultiname(param_types[i]).getName(constants, fullyQualifiedNames, false, true), HighlightSpecialType.PARAM, i); } - if (optional != null) { + if (optional != null && flagHas_optional()) { if (i >= param_types.length - optional.length) { int optionalIndex = i - (param_types.length - optional.length); writer.appendNoHilight(" = ");