/** * Returns a block consisting of the current list of statements. */ public BlockStatement toBlock() { if (optimizing) { // We put an artificial limit of 10 iterations just to prevent an endless // loop. Optimize should not loop forever, however it is hard to prove if // it always finishes in reasonable time. for (int i = 0; i < 10; i++) { if (!optimize(createOptimizeShuttle(), true)) { break; } } optimize(createFinishingOptimizeShuttle(), false); } return Expressions.block(statements); }