Class: TRuby::IR::ForLoop

Inherits:
Node
  • Object
show all
Defined in:
lib/t_ruby/ir.rb

Overview

For loop / each iteration

Instance Attribute Summary collapse

Attributes inherited from Node

#location, #metadata, #type_info

Instance Method Summary collapse

Methods inherited from Node

#accept, #transform

Constructor Details

#initialize(variable:, iterable:, body:, **opts) ⇒ ForLoop

Returns a new instance of ForLoop.



345
346
347
348
349
350
# File 'lib/t_ruby/ir.rb', line 345

def initialize(variable:, iterable:, body:, **opts)
  super(**opts)
  @variable = variable
  @iterable = iterable
  @body = body
end

Instance Attribute Details

#bodyObject

Returns the value of attribute body.



343
344
345
# File 'lib/t_ruby/ir.rb', line 343

def body
  @body
end

#iterableObject

Returns the value of attribute iterable.



343
344
345
# File 'lib/t_ruby/ir.rb', line 343

def iterable
  @iterable
end

#variableObject

Returns the value of attribute variable.



343
344
345
# File 'lib/t_ruby/ir.rb', line 343

def variable
  @variable
end

Instance Method Details

#childrenObject



352
353
354
# File 'lib/t_ruby/ir.rb', line 352

def children
  [@iterable, @body]
end