Class: SFRP::Low::Block

Inherits:
Element show all
Defined in:
lib/sfrp/low/element.rb

Instance Method Summary collapse

Methods inherited from Element

#to_s

Constructor Details

#initialize(kind_str, cond_exp, stmts) ⇒ Block

Returns a new instance of Block.



20
21
22
23
24
# File 'lib/sfrp/low/element.rb', line 20

def initialize(kind_str, cond_exp, stmts)
  @kind_str = kind_str
  @cond_exp = cond_exp
  @stmts = stmts
end

Instance Method Details

#pretty_code(indent = 0) ⇒ Object



26
27
28
29
30
# File 'lib/sfrp/low/element.rb', line 26

def pretty_code(indent = 0)
  inner = @stmts.map { |s| s.pretty_code(indent + 1) + "\n" }.join
  space = '  ' * indent
  "#{space}#{@kind_str} (#{@cond_exp}) {\n#{inner}#{space}}"
end