Fixed AS1/2 - direct editation - try..finally without catch clause

This commit is contained in:
Jindra Petřík
2021-11-28 16:59:53 +01:00
parent 11d5a55564
commit 75bfe070ca
3 changed files with 4 additions and 6 deletions

View File

@@ -185,7 +185,7 @@ public class TryActionItem extends ActionItem implements Block {
int catchSize = 0;
int catchRegister = 0;
boolean catchInRegisterFlag = false;
if (catchCommands != null && !catchCommands.isEmpty()) {
if (!catchCommands.isEmpty()) {
List<GraphSourceItem> fullCatchBody = new ArrayList<>();
@@ -266,7 +266,7 @@ public class TryActionItem extends ActionItem implements Block {
finallySize = Action.actionsToBytes(finallyCommandsA, false, SWF.DEFAULT_VERSION).length;
}
int trySize = Action.actionsToBytes(tryCommandsA, false, SWF.DEFAULT_VERSION).length;
ret.add(new ActionTry(catchInRegisterFlag, finallyCommands != null, catchCommands != null, catchName, catchRegister, trySize, catchSize, finallySize, SWF.DEFAULT_VERSION));
ret.add(new ActionTry(catchInRegisterFlag, finallyCommands != null, !catchCommands.isEmpty(), catchName, catchRegister, trySize, catchSize, finallySize, SWF.DEFAULT_VERSION));
ret.addAll(tryCommandsA);
if (catchCommandsA != null) {
ret.addAll(catchCommandsA);

View File

@@ -1313,7 +1313,7 @@ public class ActionScript2Parser {
tryCommands.add(command(inFunction, inMethod, forinlevel, inTellTarget, true, variables, functions, hasEval));
s = lex();
boolean found = false;
List<List<GraphTargetItem>> catchCommands = null;
List<List<GraphTargetItem>> catchCommands = new ArrayList<>();
List<GraphTargetItem> catchExceptionNames = new ArrayList<>();
List<GraphTargetItem> catchExceptionTypes = new ArrayList<>();
@@ -1330,9 +1330,6 @@ public class ActionScript2Parser {
lexer.pushback(s);
}
expectedType(SymbolType.PARENT_CLOSE);
if (catchCommands == null) {
catchCommands = new ArrayList<>();
}
List<GraphTargetItem> cc = new ArrayList<>();
cc.add(command(inFunction, inMethod, forinlevel, inTellTarget, true, variables, functions, hasEval));
catchCommands.add(cc);