mirror of
https://github.com/i-net-software/JWebAssembly.git
synced 2025-03-25 07:27:52 +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 );
|
TryCatchParsedBlock node = new TryCatchParsedBlock( tryCatch );
|
||||||
parsedOperations.add( node );
|
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;
|
int endPos = root.endPos;
|
||||||
|
|
||||||
|
|
||||||
// find all try blocks and the end position of the last catch/finally handler
|
// find all try blocks and the end position of the last catch/finally handler
|
||||||
int idx;
|
int idx;
|
||||||
for( idx = 0; idx < countOps; idx++ ) {
|
for( idx = 0; idx < countOps; idx++ ) {
|
||||||
@ -209,7 +211,7 @@ class BranchManager {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( gotoPos < parsedBlock.endPosition && endPos > parsedBlock.endPosition ) {
|
if( handlerPos < parsedBlock.endPosition && endPos > parsedBlock.endPosition ) {
|
||||||
endPos = parsedBlock.endPosition;
|
endPos = parsedBlock.endPosition;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1230,7 +1232,8 @@ class BranchManager {
|
|||||||
ArrayList<TryCatchFinally> catches = new ArrayList<>();
|
ArrayList<TryCatchFinally> catches = new ArrayList<>();
|
||||||
catches.add( tryCatch );
|
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;
|
int endPos = parent.endPos;
|
||||||
|
|
||||||
// find all try blocks and the end position of the last catch/finally handler
|
// find all try blocks and the end position of the last catch/finally handler
|
||||||
@ -1257,7 +1260,7 @@ class BranchManager {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( gotoPos < parsedBlock.endPosition && endPos > parsedBlock.endPosition ) {
|
if( handlerPos < parsedBlock.endPosition && endPos > parsedBlock.endPosition ) {
|
||||||
endPos = parsedBlock.endPosition;
|
endPos = parsedBlock.endPosition;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user