mirror of
https://github.com/i-net-software/JWebAssembly.git
synced 2025-03-25 07:27:52 +01:00
Fix TRY CATCH with RETURN.
This commit is contained in:
parent
a46cbe2bc5
commit
4611474ec5
@ -1170,9 +1170,14 @@ class BranchManager {
|
|||||||
endPos = parsedBlock.endPosition;
|
endPos = parsedBlock.endPosition;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( parsedBlock.startPosition > gotoPos ) {
|
if( parsedBlock.startPosition > gotoPos ) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( gotoPos < parsedBlock.endPosition && endPos > parsedBlock.endPosition ) {
|
||||||
|
endPos = parsedBlock.endPosition;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// define the try/catch/end block on the right position
|
// define the try/catch/end block on the right position
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2018 - 2021 Volker Berlin (i-net software)
|
* Copyright 2018 - 2022 Volker Berlin (i-net software)
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -57,6 +57,7 @@ public class Exceptions extends AbstractBaseTest {
|
|||||||
addParam( list, script, "multiCatch" );
|
addParam( list, script, "multiCatch" );
|
||||||
addParam( list, script, "multiCatch2" );
|
addParam( list, script, "multiCatch2" );
|
||||||
addParam( list, script, "serialCatch" );
|
addParam( list, script, "serialCatch" );
|
||||||
|
addParam( list, script, "tryReturn" );
|
||||||
}
|
}
|
||||||
rule.setTestParameters( list );
|
rule.setTestParameters( list );
|
||||||
rule.setProperty( JWebAssembly.WASM_USE_EH, "true" );
|
rule.setProperty( JWebAssembly.WASM_USE_EH, "true" );
|
||||||
@ -245,6 +246,17 @@ public class Exceptions extends AbstractBaseTest {
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Export
|
||||||
|
static public int tryReturn() {
|
||||||
|
boolean flag = true;
|
||||||
|
try {
|
||||||
|
if( flag )
|
||||||
|
return 13;
|
||||||
|
} finally {
|
||||||
|
flag = true;
|
||||||
|
}
|
||||||
|
return 42;
|
||||||
|
}
|
||||||
|
|
||||||
// @Export
|
// @Export
|
||||||
// static int npe() {
|
// static int npe() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user