Class: IV::Phonic::AST::Block

Inherits:
Statement show all
Defined in:
lib/iv/phonic/ast.rb

Instance Method Summary collapse

Methods inherited from Statement

as

Methods inherited from Node

#begin_position, #end_position, #program, #source

Constructor Details

#initialize(parent, stmt) ⇒ Block

Returns a new instance of Block.



72
73
74
75
# File 'lib/iv/phonic/ast.rb', line 72

def initialize parent, stmt
  super parent, stmt
  @body = stmt[:body].map{|item| Statement.as self, item }
end

Instance Method Details

#to_source(lv) ⇒ Object



77
78
79
# File 'lib/iv/phonic/ast.rb', line 77

def to_source lv
  "{\n#{@body.map{|stmt| stmt.to_source lv }.join('\n')}\n}".indent(lv)
end