AS3 P-code: do not show Undefined() in slot/const value

This commit is contained in:
Jindra Petřík
2021-02-08 20:15:19 +01:00
parent b8982238c6
commit 2392a5227c
2 changed files with 14 additions and 7 deletions
@@ -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;
}
@@ -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;
}