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.



556
557
558
559
# File 'lib/t_ruby/ir.rb', line 556

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

Instance Attribute Details

#typesObject

Returns the value of attribute types.



554
555
556
# File 'lib/t_ruby/ir.rb', line 554

def types
  @types
end

Instance Method Details

#to_rbsObject



561
562
563
# File 'lib/t_ruby/ir.rb', line 561

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

#to_trbObject



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

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