Class: WAG::Instruction::If

Inherits:
Object
  • Object
show all
Includes:
WAG::Instructable
Defined in:
lib/wag/instructions/if.rb

Instance Method Summary collapse

Methods included from WAG::Instructable

#f32, #f64, #i32, #i64, #local, #memory

Instance Method Details

#result(*types) ⇒ Object



7
8
9
# File 'lib/wag/instructions/if.rb', line 7

def result(*types)
  @result = WAG::Result.new(*types)
end

#then(&block) ⇒ Object Also known as: then_



11
12
13
14
15
16
# File 'lib/wag/instructions/if.rb', line 11

def then(&block)
  instruction = WAG::Then.new
  instructions << instruction
  instruction.instance_exec(&block) if block
  instruction
end

#to_sexprObject



19
20
21
22
23
# File 'lib/wag/instructions/if.rb', line 19

def to_sexpr
  return [name, @result.to_sexpr] if @result

  super()
end