From 2392a5227ce867ed67e5c310b6b96ea832cadc62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=C5=99=C3=ADk?= Date: Mon, 8 Feb 2021 18:35:39 +0100 Subject: [PATCH] AS3 P-code: do not show Undefined() in slot/const value --- .../flash/abc/avm2/parser/pcode/ASM3Parser.java | 13 +++++++++---- .../flash/abc/types/traits/TraitSlotConst.java | 8 +++++--- 2 files changed, 14 insertions(+), 7 deletions(-) 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 f593eb431..12d640db9 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 @@ -212,12 +212,17 @@ public class ASM3Parser { int slotid = (int) (long) (Long) symb.value; expected(ParsedSymbol.TYPE_KEYWORD_TYPE, "type", lexer); int type = parseMultiName(constants, lexer); - expected(ParsedSymbol.TYPE_KEYWORD_VALUE, "value", lexer); - ValueKind val = parseValue(constants, lexer); + symb = lexer.lex(); + if (symb.type == ParsedSymbol.TYPE_KEYWORD_VALUE) { + ValueKind val = parseValue(constants, lexer); + tsc.value_kind = val.value_kind; + tsc.value_index = val.value_index; + } else { + tsc.value_kind = ValueKind.CONSTANT_Undefined; + tsc.value_index = 0; + } tsc.slot_id = slotid; tsc.type_index = type; - tsc.value_kind = val.value_kind; - tsc.value_index = val.value_index; tsc.name_index = name_index; return true; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/traits/TraitSlotConst.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/traits/TraitSlotConst.java index 89f001081..e0cd63d61 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/traits/TraitSlotConst.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/traits/TraitSlotConst.java @@ -240,9 +240,11 @@ public class TraitSlotConst extends Trait implements TraitWithSlot { writer.appendNoHilight("type "); writer.hilightSpecial(abc.constants.multinameToString(type_index), HighlightSpecialType.TRAIT_TYPE_NAME); writer.newLine(); - writer.appendNoHilight("value "); - writer.hilightSpecial((new ValueKind(value_index, value_kind).toASMString(abc.constants)), HighlightSpecialType.TRAIT_VALUE); - writer.newLine(); + if (value_kind != ValueKind.CONSTANT_Undefined) { + writer.appendNoHilight("value "); + writer.hilightSpecial((new ValueKind(value_index, value_kind).toASMString(abc.constants)), HighlightSpecialType.TRAIT_VALUE); + writer.newLine(); + } return writer; }