try..catch..finally in ASC2

This commit is contained in:
Jindra Petřík
2021-01-31 11:11:16 +01:00
parent ffdea13d6a
commit 63a7a1b049
14 changed files with 206 additions and 122 deletions

View File

@@ -1023,10 +1023,14 @@ public class Graph {
return false;
}
protected List<GraphTargetItem> check(List<GotoItem> foundGotos, Map<GraphPart, List<GraphTargetItem>> partCodes, Map<GraphPart, Integer> partCodePos, GraphSource code, BaseLocalData localData, Set<GraphPart> allParts, TranslateStack stack, GraphPart parent, GraphPart part, List<GraphPart> stopPart, List<Loop> loops, List<GraphTargetItem> output, Loop currentLoop, int staticOperation, String path) throws InterruptedException {
protected List<GraphTargetItem> check(List<GraphTargetItem> currentRet, List<GotoItem> foundGotos, Map<GraphPart, List<GraphTargetItem>> partCodes, Map<GraphPart, Integer> partCodePos, GraphSource code, BaseLocalData localData, Set<GraphPart> allParts, TranslateStack stack, GraphPart parent, GraphPart part, List<GraphPart> stopPart, List<Loop> loops, List<GraphTargetItem> output, Loop currentLoop, int staticOperation, String path) throws InterruptedException {
return null;
}
protected GraphPart checkPartWithOutput(List<GraphTargetItem> output, TranslateStack stack, BaseLocalData localData, GraphPart prev, GraphPart part, Set<GraphPart> allParts) {
return checkPart(stack, localData, prev, part, allParts);
}
protected GraphPart checkPart(TranslateStack stack, BaseLocalData localData, GraphPart prev, GraphPart part, Set<GraphPart> allParts) {
return part;
}
@@ -1453,7 +1457,7 @@ public class Graph {
if (part == null) {
return ret;
}
part = checkPart(stack, localData, parent, part, allParts);
part = checkPartWithOutput(ret, stack, localData, parent, part, allParts);
if (part == null) {
return ret;
}
@@ -1610,7 +1614,7 @@ public class Graph {
}
if (parseNext) {
List<GraphTargetItem> retCheck = check(foundGotos, partCodes, partCodePos, code, localData, allParts, stack, parent, part, stopPart, loops, output, currentLoop, staticOperation, path);
List<GraphTargetItem> retCheck = check(currentRet, foundGotos, partCodes, partCodePos, code, localData, allParts, stack, parent, part, stopPart, loops, output, currentLoop, staticOperation, path);
if (retCheck != null) {
if (!retCheck.isEmpty()) {
currentRet.addAll(retCheck);
@@ -2430,12 +2434,12 @@ public class Graph {
if (p instanceof FunctionActionItem) {
commands.add(clen, p);
} else {
/*if (isExit) {
if (isExit) {
//ASC2 leaves some function calls unpopped on stack before returning from a method
commands.add(clen, p);
} else {*/
} else {
commands.add(clen, new PushItem(p));
//}
}
}
}
}