mirror of
https://github.com/i-net-software/JWebAssembly.git
synced 2025-03-15 02:44:47 +01:00
Warning for multiple CATCH blocks
This commit is contained in:
parent
1a89919984
commit
724f39dc18
@ -741,6 +741,14 @@ class BranchManger {
|
||||
int idx;
|
||||
for( idx = 0; idx < parsedOperations.size(); idx++ ) {
|
||||
ParsedBlock parsedBlock = parsedOperations.get( idx );
|
||||
|
||||
if( parsedBlock.op == JavaBlockOperator.TRY ) {
|
||||
TryCatchFinally tryCatch2 = ((TryCatchParsedBlock)parsedBlock).tryCatch;
|
||||
if( tryCatch.getStart() == tryCatch2.getStart() && tryCatch.getEnd() == tryCatch2.getEnd() ) {
|
||||
throw new WasmException( "Try with multiple catch blocks can't compile currently.", null, null, tryBlock.lineNumber );
|
||||
}
|
||||
}
|
||||
|
||||
if( parsedBlock.startPosition == gotoPos && parsedBlock.op == JavaBlockOperator.GOTO && parsedBlock.startPosition < parsedBlock.endPosition ) {
|
||||
parsedOperations.remove( idx );
|
||||
endPos = parsedBlock.endPosition;
|
||||
|
@ -130,6 +130,19 @@ public class Exceptions extends AbstractBaseTest {
|
||||
return v;
|
||||
}
|
||||
|
||||
// @Export
|
||||
// static int multiCatch() {
|
||||
// int r;
|
||||
// try {
|
||||
// r = 5 / 0;
|
||||
// } catch(RuntimeException ex ) {
|
||||
// r = 1;
|
||||
// } catch(Exception ex ) {
|
||||
// r = 2;
|
||||
// }
|
||||
// return r;
|
||||
// }
|
||||
|
||||
// @Export
|
||||
// static int npe() {
|
||||
// Object obj = new NullPointerException();
|
||||
|
Loading…
x
Reference in New Issue
Block a user