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
268 269 270 271 272 273 274 |
# File 'lib/t_ruby/ir.rb', line 268 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.
265 266 267 |
# File 'lib/t_ruby/ir.rb', line 265 def condition @condition end |
#else_branch ⇒ Object
Returns the value of attribute else_branch.
265 266 267 |
# File 'lib/t_ruby/ir.rb', line 265 def else_branch @else_branch end |
#kind ⇒ Object
Returns the value of attribute kind.
265 266 267 |
# File 'lib/t_ruby/ir.rb', line 265 def kind @kind end |
#then_branch ⇒ Object
Returns the value of attribute then_branch.
265 266 267 |
# File 'lib/t_ruby/ir.rb', line 265 def then_branch @then_branch end |
Instance Method Details
#children ⇒ Object
276 277 278 |
# File 'lib/t_ruby/ir.rb', line 276 def children [@condition, @then_branch, @else_branch].compact end |