Class: TRuby::IR::Loop

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

Overview

Loop constructs

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(kind:, body:, condition: nil, **opts) ⇒ Loop

kind: :while, :until, :loop



347
348
349
350
351
352
# File 'lib/t_ruby/ir.rb', line 347

def initialize(kind:, body:, condition: nil, **opts)
  super(**opts)
  @kind = kind
  @condition = condition
  @body = body
end

Instance Attribute Details

#bodyObject

Returns the value of attribute body.



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

def body
  @body
end

#conditionObject

Returns the value of attribute condition.



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

def condition
  @condition
end

#kindObject

Returns the value of attribute kind.



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

def kind
  @kind
end

Instance Method Details

#childrenObject



354
355
356
# File 'lib/t_ruby/ir.rb', line 354

def children
  [@condition, @body].compact
end