Class: JIT::Function::If

Inherits:
Object
  • Object
show all
Defined in:
lib/jit/function.rb

Overview

:nodoc:

Instance Method Summary collapse

Constructor Details

#initialize(function, end_label) ⇒ If

Returns a new instance of If.



52
53
54
55
# File 'lib/jit/function.rb', line 52

def initialize(function, end_label)
  @function = function
  @end_label = end_label
end

Instance Method Details

#else(&block) ⇒ Object



57
58
59
60
# File 'lib/jit/function.rb', line 57

def else(&block)
  block.call
  return self
end

#elsif(cond, &block) ⇒ Object



62
63
64
# File 'lib/jit/function.rb', line 62

def elsif(cond, &block)
  return @function.if(cond, @end_label, &block)
end

#elsunless(cond, &block) ⇒ Object



66
67
68
# File 'lib/jit/function.rb', line 66

def elsunless(cond, &block)
  return @function.unless(cond, @end_label, &block)
end

#endObject



70
71
72
# File 'lib/jit/function.rb', line 70

def end
  @function.insn_label(@end_label)
end