Class: TRuby::IR::GenericType

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

Overview

Generic type (Array<String>, Map<K, V>)

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(base:, type_args: [], **opts) ⇒ GenericType

Returns a new instance of GenericType.



519
520
521
522
523
# File 'lib/t_ruby/ir.rb', line 519

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

Instance Attribute Details

#baseObject

Returns the value of attribute base.



517
518
519
# File 'lib/t_ruby/ir.rb', line 517

def base
  @base
end

#type_argsObject

Returns the value of attribute type_args.



517
518
519
# File 'lib/t_ruby/ir.rb', line 517

def type_args
  @type_args
end

Instance Method Details

#to_rbsObject



525
526
527
# File 'lib/t_ruby/ir.rb', line 525

def to_rbs
  "#{@base}[#{@type_args.map(&:to_rbs).join(', ')}]"
end

#to_trbObject



529
530
531
# File 'lib/t_ruby/ir.rb', line 529

def to_trb
  "#{@base}<#{@type_args.map(&:to_trb).join(', ')}>"
end