Class: RBS::AST::Ruby::Annotations::ParamTypeAnnotation

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:, name_location:, colon_location:, param_type:, comment_location:) ⇒ ParamTypeAnnotation

Returns a new instance of ParamTypeAnnotation.



259
260
261
262
263
264
265
# File 'lib/rbs/ast/ruby/annotations.rb', line 259

def initialize(location:, prefix_location:, name_location:, colon_location:, param_type:, comment_location:)
  super(location, prefix_location)
  @name_location = name_location
  @colon_location = colon_location
  @param_type = param_type
  @comment_location = comment_location
end

Instance Attribute Details

#colon_locationObject (readonly)

Returns the value of attribute colon_location.



257
258
259
# File 'lib/rbs/ast/ruby/annotations.rb', line 257

def colon_location
  @colon_location
end

#comment_locationObject (readonly)

Returns the value of attribute comment_location.



257
258
259
# File 'lib/rbs/ast/ruby/annotations.rb', line 257

def comment_location
  @comment_location
end

#name_locationObject (readonly)

Returns the value of attribute name_location.



257
258
259
# File 'lib/rbs/ast/ruby/annotations.rb', line 257

def name_location
  @name_location
end

#param_typeObject (readonly)

Returns the value of attribute param_type.



257
258
259
# File 'lib/rbs/ast/ruby/annotations.rb', line 257

def param_type
  @param_type
end

Instance Method Details

#map_type_name(&block) ⇒ Object



267
268
269
270
271
272
273
274
275
276
# File 'lib/rbs/ast/ruby/annotations.rb', line 267

def map_type_name(&block)
  self.class.new(
    location:,
    prefix_location:,
    name_location: name_location,
    colon_location: colon_location,
    param_type: param_type.map_type_name { yield _1 },
    comment_location: comment_location
  ) #: self
end

#type_fingerprintObject



278
279
280
281
282
283
284
285
# File 'lib/rbs/ast/ruby/annotations.rb', line 278

def type_fingerprint
  [
    "annots/param_type",
    name_location.source,
    param_type.to_s,
    comment_location&.source
  ]
end