From fbd0d9f5cb5606d1eb49e004fc6fff7567e036bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=C5=99=C3=ADk?= Date: Wed, 11 Jan 2023 17:49:14 +0100 Subject: [PATCH] Fixed #1888 AS3 - missing casts in declarations --- CHANGELOG.md | 2 ++ .../flash/abc/avm2/model/clauses/DeclarationAVM2Item.java | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3f8ad71fe..dc76cc9ad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ All notable changes to this project will be documented in this file. ## [Unreleased] +### Fixed +- [#1888] AS3 - missing casts in declarations ## [18.3.2] - 2023-01-10 ### Removed diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/clauses/DeclarationAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/clauses/DeclarationAVM2Item.java index 539a5afa6..a363e0abd 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/clauses/DeclarationAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/clauses/DeclarationAVM2Item.java @@ -135,7 +135,7 @@ public class DeclarationAVM2Item extends AVM2Item { coerType = ((ConvertAVM2Item) ssti.value).type; } //strip coerce if its declared as this type - if (coerType.equals(type) && !coerType.equals(TypeItem.UNBOUNDED)) { + if ((ssti.value instanceof CoerceAVM2Item) && coerType.equals(type) && !coerType.equals(TypeItem.UNBOUNDED)) { val = val.value; } @@ -167,7 +167,7 @@ public class DeclarationAVM2Item extends AVM2Item { coerType = ((ConvertAVM2Item) spti.value).type; } //strip coerce if its declared as this type - if (coerType.equals(type) && !coerType.equals(TypeItem.UNBOUNDED)) { + if ((spti.value instanceof CoerceAVM2Item) && coerType.equals(type) && !coerType.equals(TypeItem.UNBOUNDED)) { val = val.value; }