mirror of
https://github.com/i-net-software/JWebAssembly.git
synced 2025-03-15 02:44:47 +01:00
correct the end position of CATCH blocks
This commit is contained in:
parent
bf7518e5d4
commit
fd3c698ef5
@ -191,9 +191,11 @@ class BranchManager {
|
||||
TryCatchParsedBlock node = new TryCatchParsedBlock( tryCatch );
|
||||
parsedOperations.add( node );
|
||||
|
||||
int gotoPos = tryCatch.getHandler() - 3; //tryCatch.getEnd() points some time before and some time after the goto
|
||||
int handlerPos = tryCatch.getHandler();
|
||||
int gotoPos = handlerPos - 3; //tryCatch.getEnd() points some time before and some time after the goto
|
||||
int endPos = root.endPos;
|
||||
|
||||
|
||||
// find all try blocks and the end position of the last catch/finally handler
|
||||
int idx;
|
||||
for( idx = 0; idx < countOps; idx++ ) {
|
||||
@ -209,7 +211,7 @@ class BranchManager {
|
||||
break;
|
||||
}
|
||||
|
||||
if( gotoPos < parsedBlock.endPosition && endPos > parsedBlock.endPosition ) {
|
||||
if( handlerPos < parsedBlock.endPosition && endPos > parsedBlock.endPosition ) {
|
||||
endPos = parsedBlock.endPosition;
|
||||
}
|
||||
}
|
||||
@ -1230,7 +1232,8 @@ class BranchManager {
|
||||
ArrayList<TryCatchFinally> catches = new ArrayList<>();
|
||||
catches.add( tryCatch );
|
||||
|
||||
int gotoPos = tryCatch.getHandler()-3; //tryCatch.getEnd() points some time before and some time after the goto
|
||||
int handlerPos = tryCatch.getHandler();
|
||||
int gotoPos = handlerPos - 3; //tryCatch.getEnd() points some time before and some time after the goto
|
||||
int endPos = parent.endPos;
|
||||
|
||||
// find all try blocks and the end position of the last catch/finally handler
|
||||
@ -1257,7 +1260,7 @@ class BranchManager {
|
||||
break;
|
||||
}
|
||||
|
||||
if( gotoPos < parsedBlock.endPosition && endPos > parsedBlock.endPosition ) {
|
||||
if( handlerPos < parsedBlock.endPosition && endPos > parsedBlock.endPosition ) {
|
||||
endPos = parsedBlock.endPosition;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user