Class: TRuby::IR::Conditional
Overview
Conditional (if/unless)
Instance Attribute Summary collapse
-
#condition ⇒ Object
Returns the value of attribute condition.
-
#else_branch ⇒ Object
Returns the value of attribute else_branch.
-
#kind ⇒ Object
Returns the value of attribute kind.
-
#then_branch ⇒ Object
Returns the value of attribute then_branch.
Attributes inherited from Node
#location, #metadata, #type_info
Instance Method Summary collapse
- #children ⇒ Object
-
#initialize(condition:, then_branch:, else_branch: nil, kind: :if, **opts) ⇒ Conditional
constructor
kind: :if, :unless, :ternary.
Methods inherited from Node
Constructor Details
#initialize(condition:, then_branch:, else_branch: nil, kind: :if, **opts) ⇒ Conditional
kind: :if, :unless, :ternary
298 299 300 301 302 303 304 |
# File 'lib/t_ruby/ir.rb', line 298 def initialize(condition:, then_branch:, else_branch: nil, kind: :if, **opts) super(**opts) @condition = condition @then_branch = then_branch @else_branch = else_branch @kind = kind end |
Instance Attribute Details
#condition ⇒ Object
Returns the value of attribute condition.
295 296 297 |
# File 'lib/t_ruby/ir.rb', line 295 def condition @condition end |
#else_branch ⇒ Object
Returns the value of attribute else_branch.
295 296 297 |
# File 'lib/t_ruby/ir.rb', line 295 def else_branch @else_branch end |
#kind ⇒ Object
Returns the value of attribute kind.
295 296 297 |
# File 'lib/t_ruby/ir.rb', line 295 def kind @kind end |
#then_branch ⇒ Object
Returns the value of attribute then_branch.
295 296 297 |
# File 'lib/t_ruby/ir.rb', line 295 def then_branch @then_branch end |
Instance Method Details
#children ⇒ Object
306 307 308 |
# File 'lib/t_ruby/ir.rb', line 306 def children [@condition, @then_branch, @else_branch].compact end |