mirror of
https://github.com/i-net-software/JWebAssembly.git
synced 2025-03-25 07:27:52 +01:00
fix conditionals expressions as method parameters in a SWITCH.
This commit is contained in:
parent
f61a994d40
commit
9acda37be4
@ -885,7 +885,7 @@ class BranchManager {
|
|||||||
for( int p = 0; p < parsedOperations.size(); p++ ) {
|
for( int p = 0; p < parsedOperations.size(); p++ ) {
|
||||||
ParsedBlock parsedBlock = parsedOperations.get( p );
|
ParsedBlock parsedBlock = parsedOperations.get( p );
|
||||||
int start = parsedBlock.startPosition;
|
int start = parsedBlock.startPosition;
|
||||||
if( startPosition >= lastPosition ) {
|
if( start >= lastPosition ) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if( parsedBlock.op != JavaBlockOperator.IF ) {
|
if( parsedBlock.op != JavaBlockOperator.IF ) {
|
||||||
@ -923,10 +923,11 @@ class BranchManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// handle the GOTO (breaks) at the end of the CASE blocks.
|
// handle the GOTO (breaks) at the end of the CASE blocks.
|
||||||
|
int lastBlockPosition = lastPosition;
|
||||||
for( Iterator<ParsedBlock> it = parsedOperations.iterator(); it.hasNext(); ) {
|
for( Iterator<ParsedBlock> it = parsedOperations.iterator(); it.hasNext(); ) {
|
||||||
ParsedBlock parsedBlock = it.next();
|
ParsedBlock parsedBlock = it.next();
|
||||||
int start = parsedBlock.startPosition;
|
int start = parsedBlock.startPosition;
|
||||||
if( startPosition >= lastPosition ) {
|
if( start >= lastBlockPosition ) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
switch( parsedBlock.op ) {
|
switch( parsedBlock.op ) {
|
||||||
|
@ -46,6 +46,7 @@ public class ControlFlowOperators extends AbstractBaseTest {
|
|||||||
addParam( list, script, "ifMultipleDouble" );
|
addParam( list, script, "ifMultipleDouble" );
|
||||||
addParam( list, script, "ifCompare" );
|
addParam( list, script, "ifCompare" );
|
||||||
addParam( list, script, "switchDirect" );
|
addParam( list, script, "switchDirect" );
|
||||||
|
addParam( list, script, "switchWithConditionMethodParams" );
|
||||||
addParam( list, script, "endlessLoop" );
|
addParam( list, script, "endlessLoop" );
|
||||||
addParam( list, script, "doWhileLoop" );
|
addParam( list, script, "doWhileLoop" );
|
||||||
addParam( list, script, "doWhileLoopTwoConditions" );
|
addParam( list, script, "doWhileLoopTwoConditions" );
|
||||||
@ -287,6 +288,20 @@ public class ControlFlowOperators extends AbstractBaseTest {
|
|||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Export
|
||||||
|
public static int switchWithConditionMethodParams() {
|
||||||
|
int last = 8;
|
||||||
|
switch( last ) {
|
||||||
|
case -2:
|
||||||
|
last = -13;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
last = tableSwitch( (last == 0 ? 0 : last) );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return last;
|
||||||
|
}
|
||||||
|
|
||||||
@Export
|
@Export
|
||||||
static int endlessLoop() {
|
static int endlessLoop() {
|
||||||
int a = 0;
|
int a = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user