Class: SFRP::Low::Block
Instance Method Summary collapse
-
#initialize(kind_str, cond_exp, stmts) ⇒ Block
constructor
A new instance of Block.
- #pretty_code(indent = 0) ⇒ Object
Methods inherited from Element
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 |