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

kind: :while, :until, :loop



317
318
319
320
321
322
# File 'lib/t_ruby/ir.rb', line 317

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

Instance Attribute Details

#bodyObject

Returns the value of attribute body.



314
315
316
# File 'lib/t_ruby/ir.rb', line 314

def body
  @body
end

#conditionObject

Returns the value of attribute condition.



314
315
316
# File 'lib/t_ruby/ir.rb', line 314

def condition
  @condition
end

#kindObject

Returns the value of attribute kind.



314
315
316
# File 'lib/t_ruby/ir.rb', line 314

def kind
  @kind
end

Instance Method Details

#childrenObject



324
325
326
# File 'lib/t_ruby/ir.rb', line 324

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