From b0d36559191ea39e27b522cd49b3090c493f9743 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=C5=99=C3=ADk?= Date: Sun, 11 Aug 2024 11:37:20 +0200 Subject: [PATCH] AS3 direct editation - only allow float and decimal when ABC supports it --- .../avm2/parser/script/ActionScript3Parser.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ActionScript3Parser.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ActionScript3Parser.java index ca00a940c..b5329b2a0 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ActionScript3Parser.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ActionScript3Parser.java @@ -2475,15 +2475,28 @@ public class ActionScript3Parser { allowMemberOrCall = true; // 5.2.toString(); break; case DECIMAL: + if (!abc.hasDecimalSupport()) { + throw new AVM2ParseException("The ABC has no decimal support", lexer.yyline()); + } ret = new DecimalValueAVM2Item(null, null, (Decimal128) s.value); allowMemberOrCall = true; break; case FLOAT: + if (!abc.hasFloatSupport()) { + throw new AVM2ParseException("The ABC has no float support", lexer.yyline()); + } ret = new FloatValueAVM2Item(null, null, (Float) s.value); allowMemberOrCall = true; break; case FLOAT4: - ret = new Float4ValueAVM2Item(null, null, (Float4) s.value); + if (!abc.hasFloatSupport()) { + //parse again as method call + lexer.yypushbackstr(lexer.yytext().substring("float4".length())); + lexer.pushback(new ParsedSymbol(SymbolGroup.IDENTIFIER, SymbolType.IDENTIFIER, "float4")); + ret = name(allOpenedNamespaces, thisType, pkg, needsActivation, false, openedNamespaces, registerVars, inFunction, inMethod, variables, importedClasses, abc); + } else { + ret = new Float4ValueAVM2Item(null, null, (Float4) s.value); + } allowMemberOrCall = true; break; case DELETE: