Class: TRuby::IR::IntersectionType

Inherits:
TypeNode show all
Defined in:
lib/t_ruby/ir.rb

Overview

Intersection type (Readable & Writable)

Instance Attribute Summary collapse

Attributes inherited from Node

#location, #metadata, #type_info

Instance Method Summary collapse

Methods inherited from Node

#accept, #children, #transform

Constructor Details

#initialize(types: [], **opts) ⇒ IntersectionType

Returns a new instance of IntersectionType.



568
569
570
571
# File 'lib/t_ruby/ir.rb', line 568

def initialize(types: [], **opts)
  super(**opts)
  @types = types
end

Instance Attribute Details

#typesObject

Returns the value of attribute types.



566
567
568
# File 'lib/t_ruby/ir.rb', line 566

def types
  @types
end

Instance Method Details

#to_rbsObject



573
574
575
# File 'lib/t_ruby/ir.rb', line 573

def to_rbs
  @types.map(&:to_rbs).join(" & ")
end

#to_trbObject



577
578
579
# File 'lib/t_ruby/ir.rb', line 577

def to_trb
  @types.map(&:to_trb).join(" & ")
end