Class: Duby::Compiler::JavaSource::ComplexWhileLoop

Inherits:
SimpleWhileLoop show all
Includes:
Redoable
Defined in:
lib/duby/jvm/source_generator/loops.rb

Instance Attribute Summary

Attributes inherited from SimpleWhileLoop

#compiler, #loop

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_bodyObject



92
93
94
95
96
97
98
99
100
101
# File 'lib/duby/jvm/source_generator/loops.rb', line 92

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

#prepareObject



84
85
86
87
88
89
90
# File 'lib/duby/jvm/source_generator/loops.rb', line 84

def prepare
  super
  @outer = compiler.method.label
  @inner = compiler.method.label
  @complex_predicate = !loop.condition.predicate.expr?(compiler)
  compiler.method.puts "#{@outer}:"
end