Class: Duby::Compiler::JavaSource::ComplexWhileLoop
- Inherits:
-
SimpleWhileLoop
- Object
- SimpleWhileLoop
- Duby::Compiler::JavaSource::ComplexWhileLoop
- Includes:
- Redoable
- Defined in:
- lib/duby/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 Duby::Compiler::JavaSource::SimpleWhileLoop
Instance Method Details
#compile_body ⇒ Object
99 100 101 102 103 104 105 106 107 108 |
# File 'lib/duby/jvm/source_generator/loops.rb', line 99 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) end end end |
#prepare ⇒ Object
87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/duby/jvm/source_generator/loops.rb', line 87 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 |