Class: Mirah::JVM::Compiler::JavaSource::ComplexWhileLoop
- Inherits:
-
SimpleWhileLoop
- Object
- SimpleWhileLoop
- Mirah::JVM::Compiler::JavaSource::ComplexWhileLoop
- Includes:
- Redoable
- Defined in:
- lib/mirah/jvm/source_generator/loops.rb
Instance Attribute Summary
Attributes inherited from SimpleWhileLoop
Instance Method Summary collapse
Methods included from Redoable
#break, #compile_with_redo, #next, #redo
Methods inherited from SimpleWhileLoop
#break, #compile, #initialize, #next, #redo
Constructor Details
This class inherits a constructor from Mirah::JVM::Compiler::JavaSource::SimpleWhileLoop
Instance Method Details
#compile_body ⇒ Object
117 118 119 120 121 122 123 124 125 126 |
# File 'lib/mirah/jvm/source_generator/loops.rb', line 117 def compile_body if @loop.redo? compile_with_redo(@loop.body) else compiler.method.puts "#{@inner}:" compiler.method.block do loop.body.compile(compiler, false) if loop.body end end end |
#prepare ⇒ Object
105 106 107 108 109 110 111 112 113 114 115 |
# File 'lib/mirah/jvm/source_generator/loops.rb', line 105 def prepare super @outer = compiler.method.label @inner = compiler.method.label @complex_predicate = !loop.condition.predicate.expr?(compiler) super_start = @start @start = lambda do compiler.method.puts "#{@outer}:" super_start.call end end |