mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-07-05 22:08:01 +00:00
Fixed: AS3 decompilation: try..catch..finally suborder when debugline info not present
This commit is contained in:
@@ -816,19 +816,25 @@ public class AVM2Graph extends Graph {
|
||||
if (!previouslyCatchedExceptionIds.contains(e)) {
|
||||
if (addr == fixedExStart) { //avm2code.getAddrThroughJumpAndDebugLine(fixedExStart)) {
|
||||
ABCException ex = body.exceptions[e];
|
||||
|
||||
if (ex.isFinally()) {
|
||||
finnalysIndicesToBe.add(e);
|
||||
if (fixedExEnd >= maxEndAddr) {
|
||||
finnalysIndicesToBe.add(e);
|
||||
}
|
||||
} else {
|
||||
long endAddr = avm2code.getAddrThroughJumpAndDebugLine(fixedExEnd);
|
||||
long endAddr = fixedExEnd;
|
||||
if (endAddr > maxEndAddr) {
|
||||
catchedExceptionIds.clear();
|
||||
maxEndAddr = avm2code.getAddrThroughJumpAndDebugLine(fixedExEnd);
|
||||
/*endIp = avm2code.adr2pos(maxEndAddr);
|
||||
realEndIp = avm2code.adr2pos(fixedExEnd);*/
|
||||
maxEndAddr = fixedExEnd;
|
||||
|
||||
catchedExceptionIds.add(e);
|
||||
|
||||
//filter finallys that have lower endAddr - they do not belong to these catches
|
||||
for (int k = 0; k < finnalysIndicesToBe.size(); k++) {
|
||||
if (body.exceptions[finnalysIndicesToBe.get(k)].end < endAddr) {
|
||||
finnalysIndicesToBe.remove(k);
|
||||
k--;
|
||||
}
|
||||
}
|
||||
} else if (endAddr == maxEndAddr) {
|
||||
catchedExceptionIds.add(e);
|
||||
}
|
||||
@@ -849,11 +855,24 @@ public class AVM2Graph extends Graph {
|
||||
outSideExceptionPart = searchFirstPartOutSideTryCatch(localData, body.exceptions[catchedExceptionIds.get(0)], loops, allParts);
|
||||
}
|
||||
|
||||
if (!finnalysIndicesToBe.isEmpty()) {
|
||||
long maxEnd = 0;
|
||||
int maxF = -1;
|
||||
for (int f : finnalysIndicesToBe) {
|
||||
long fixedExEnd = avm2code.pos2adr(avm2code.adr2pos(body.exceptions[f].end, true));
|
||||
if (fixedExEnd > maxEnd) {
|
||||
maxEnd = fixedExEnd;
|
||||
maxF = f;
|
||||
}
|
||||
}
|
||||
finnalysIndicesToBe.clear();
|
||||
finnalysIndicesToBe.add(maxF);
|
||||
}
|
||||
|
||||
for (int e : finnalysIndicesToBe) {
|
||||
ABCException finallyExceptionToBe = body.exceptions[e];
|
||||
if (catchedExceptionIds.isEmpty() || outSideExceptionPart == null) {
|
||||
//there's no exception, finally only
|
||||
finallyIndex.setVal(e);
|
||||
//there's no exception, finally only
|
||||
break;
|
||||
}
|
||||
GraphPart outSideExceptionNonEmptyPart = nearestNonEmptyPart(outSideExceptionPart);
|
||||
@@ -883,6 +902,11 @@ public class AVM2Graph extends Graph {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (finallyIndex.getVal() == -1 && !finnalysIndicesToBe.isEmpty()) {
|
||||
catchedExceptionIds.clear();
|
||||
finallyIndex.setVal(finnalysIndicesToBe.get(0));
|
||||
}
|
||||
}
|
||||
|
||||
private boolean checkTry(List<GraphTargetItem> currentRet, List<GotoItem> foundGotos, Map<GraphPart, List<GraphTargetItem>> partCodes, Map<GraphPart, Integer> partCodePos, Set<GraphPart> visited, AVM2LocalData localData, GraphPart part, List<GraphPart> stopPart, List<Loop> loops, List<ThrowState> throwStates, Set<GraphPart> allParts, TranslateStack stack, int staticOperation, String path, int recursionLevel) throws InterruptedException {
|
||||
|
||||
Reference in New Issue
Block a user