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



395
396
397
398
399
400
# File 'lib/t_ruby/ir.rb', line 395

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.



392
393
394
# File 'lib/t_ruby/ir.rb', line 392

def expression
  @expression
end

#kindObject

Returns the value of attribute kind.



392
393
394
# File 'lib/t_ruby/ir.rb', line 392

def kind
  @kind
end

#target_typeObject

Returns the value of attribute target_type.



392
393
394
# File 'lib/t_ruby/ir.rb', line 392

def target_type
  @target_type
end

Instance Method Details

#childrenObject



402
403
404
# File 'lib/t_ruby/ir.rb', line 402

def children
  [@expression]
end