Class: RBS::AST::Ruby::Annotations::TypeApplicationAnnotation

Inherits:
Base
  • Object
show all
Defined in:
lib/rbs/ast/ruby/annotations.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#location, #prefix_location

Instance Method Summary collapse

Methods inherited from Base

#buffer

Constructor Details

#initialize(location:, prefix_location:, type_args:, close_bracket_location:, comma_locations:) ⇒ TypeApplicationAnnotation

Returns a new instance of TypeApplicationAnnotation.



195
196
197
198
199
200
# File 'lib/rbs/ast/ruby/annotations.rb', line 195

def initialize(location:, prefix_location:, type_args:, close_bracket_location:, comma_locations:)
  super(location, prefix_location)
  @type_args = type_args
  @close_bracket_location = close_bracket_location
  @comma_locations = comma_locations
end

Instance Attribute Details

#close_bracket_locationObject (readonly)

Returns the value of attribute close_bracket_location.



193
194
195
# File 'lib/rbs/ast/ruby/annotations.rb', line 193

def close_bracket_location
  @close_bracket_location
end

#comma_locationsObject (readonly)

Returns the value of attribute comma_locations.



193
194
195
# File 'lib/rbs/ast/ruby/annotations.rb', line 193

def comma_locations
  @comma_locations
end

#type_argsObject (readonly)

Returns the value of attribute type_args.



193
194
195
# File 'lib/rbs/ast/ruby/annotations.rb', line 193

def type_args
  @type_args
end

Instance Method Details

#map_type_name(&block) ⇒ Object



202
203
204
205
206
207
208
209
210
211
212
# File 'lib/rbs/ast/ruby/annotations.rb', line 202

def map_type_name(&block)
  mapped_type_args = type_args.map { |type| type.map_type_name { yield _1 } }

  self.class.new(
    location:,
    prefix_location:,
    type_args: mapped_type_args,
    close_bracket_location:,
    comma_locations:
  ) #: self
end

#type_fingerprintObject



214
215
216
217
218
219
# File 'lib/rbs/ast/ruby/annotations.rb', line 214

def type_fingerprint
  [
    "annots/type_application",
    type_args.map(&:to_s)
  ]
end