mirror of
https://github.com/i-net-software/JWebAssembly.git
synced 2025-03-25 07:27:52 +01:00
Warning for multiple CATCH blocks
This commit is contained in:
parent
1a89919984
commit
724f39dc18
@ -741,6 +741,14 @@ class BranchManger {
|
|||||||
int idx;
|
int idx;
|
||||||
for( idx = 0; idx < parsedOperations.size(); idx++ ) {
|
for( idx = 0; idx < parsedOperations.size(); idx++ ) {
|
||||||
ParsedBlock parsedBlock = parsedOperations.get( 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 ) {
|
if( parsedBlock.startPosition == gotoPos && parsedBlock.op == JavaBlockOperator.GOTO && parsedBlock.startPosition < parsedBlock.endPosition ) {
|
||||||
parsedOperations.remove( idx );
|
parsedOperations.remove( idx );
|
||||||
endPos = parsedBlock.endPosition;
|
endPos = parsedBlock.endPosition;
|
||||||
|
@ -130,6 +130,19 @@ public class Exceptions extends AbstractBaseTest {
|
|||||||
return v;
|
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
|
// @Export
|
||||||
// static int npe() {
|
// static int npe() {
|
||||||
// Object obj = new NullPointerException();
|
// Object obj = new NullPointerException();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user