Skip to content

Commit

Permalink
ISGOSU-295. Backport 0a3d4ec from 1.14
Browse files Browse the repository at this point in the history
  • Loading branch information
rsmckinney committed Mar 18, 2020
1 parent 4643848 commit 69021e2
Showing 1 changed file with 7 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,30 +25,15 @@ public static void compile( IRDoWhileStatement doWhileStatement, IRBytecodeConte
context.pushScope();
try
{
if( doWhileStatement.getLeastSignificantTerminalStatement() != null )
{
context.visitLabel( conditionLabel );
IRBytecodeCompiler.compileIRStatement( doWhileStatement.getBody(), context );
context.visitLabel( breakLabel );
}
else
{
context.visitLabel( loopBodyStart ); // body start
IRBytecodeCompiler.compileIRStatement( doWhileStatement.getBody(), context );
context.visitLabel( loopBodyStart ); // body start
IRBytecodeCompiler.compileIRStatement( doWhileStatement.getBody(), context );

context.visitLabel( conditionLabel );
context.setLineNumber( doWhileStatement.getLoopTest().getLineNumber() );
IRBytecodeCompiler.compileIRExpression( doWhileStatement.getLoopTest(), context );
context.getMv().visitJumpInsn( Opcodes.IFNE, loopBodyStart );
context.visitLabel( conditionLabel );
context.setLineNumber( doWhileStatement.getLoopTest().getLineNumber() );
IRBytecodeCompiler.compileIRExpression( doWhileStatement.getLoopTest(), context );
context.getMv().visitJumpInsn( Opcodes.IFNE, loopBodyStart );

context.getMv().visitLabel( breakLabel );

IRReturnStatement implicitReturn = doWhileStatement.getImplicitReturnStatement();
if( implicitReturn != null )
{
IRBytecodeCompiler.compileIRStatement( implicitReturn, context );
}
}
context.getMv().visitLabel( breakLabel );
}
finally
{
Expand Down

0 comments on commit 69021e2

Please sign in to comment.