Class: TRuby::IR::NullableType

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

Overview

Nullable type (String?)

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(inner_type:, **opts) ⇒ NullableType

Returns a new instance of NullableType.



629
630
631
632
# File 'lib/t_ruby/ir.rb', line 629

def initialize(inner_type:, **opts)
  super(**opts)
  @inner_type = inner_type
end

Instance Attribute Details

#inner_typeObject

Returns the value of attribute inner_type.



627
628
629
# File 'lib/t_ruby/ir.rb', line 627

def inner_type
  @inner_type
end

Instance Method Details

#to_rbsObject



634
635
636
# File 'lib/t_ruby/ir.rb', line 634

def to_rbs
  "#{@inner_type.to_rbs}?"
end

#to_trbObject



638
639
640
# File 'lib/t_ruby/ir.rb', line 638

def to_trb
  "#{@inner_type.to_trb}?"
end