Class: IV::Phonic::AST::ForStatement

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) ⇒ ForStatement

Returns a new instance of ForStatement.



163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
# File 'lib/iv/phonic/ast.rb', line 163

def initialize parent, stmt
  super parent, stmt
  if stmt[:init]
    @init = Statement.as self, stmt[:init]
  else
    @init = nil
  end
  if stmt[:cond]
    @cond = Expression.as self, stmt[:cond]
  else
    @cond = nil
  end
  if stmt[:next]
    @next = Statement.as self, stmt[:next]
  else
    @next = nil
  end
  @body = Statement.as self, stmt[:body]
end