Class: TRuby::IR::TypeCast

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

Overview

Type cast / assertion

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(expression:, target_type:, kind: :as, **opts) ⇒ TypeCast

kind: :as, :assert



425
426
427
428
429
430
# File 'lib/t_ruby/ir.rb', line 425

def initialize(expression:, target_type:, kind: :as, **opts)
  super(**opts)
  @expression = expression
  @target_type = target_type
  @kind = kind
end

Instance Attribute Details

#expressionObject

Returns the value of attribute expression.



422
423
424
# File 'lib/t_ruby/ir.rb', line 422

def expression
  @expression
end

#kindObject

Returns the value of attribute kind.



422
423
424
# File 'lib/t_ruby/ir.rb', line 422

def kind
  @kind
end

#target_typeObject

Returns the value of attribute target_type.



422
423
424
# File 'lib/t_ruby/ir.rb', line 422

def target_type
  @target_type
end

Instance Method Details

#childrenObject



432
433
434
# File 'lib/t_ruby/ir.rb', line 432

def children
  [@expression]
end