Class: RBS::AST::Ruby::Declarations::ClassDecl::SuperClass

Inherits:
Object
  • Object
show all
Defined in:
lib/rbs/ast/ruby/declarations.rb,
sig/ast/ruby/declarations.rbs

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type_name_location, operator_location, type_name, type_annotation) ⇒ SuperClass

Returns a new instance of SuperClass.

Parameters:



28
29
30
31
32
33
# File 'lib/rbs/ast/ruby/declarations.rb', line 28

def initialize(type_name_location, operator_location, type_name, type_annotation)
  @type_name_location = type_name_location
  @operator_location = operator_location
  @type_name = type_name
  @type_annotation = type_annotation
end

Instance Attribute Details

#operator_locationLocation (readonly)

Returns the value of attribute operator_location.

Returns:



22
23
24
# File 'lib/rbs/ast/ruby/declarations.rb', line 22

def operator_location
  @operator_location
end

#type_annotationAnnotations::TypeApplicationAnnotation? (readonly)

Returns the value of attribute type_annotation.



26
27
28
# File 'lib/rbs/ast/ruby/declarations.rb', line 26

def type_annotation
  @type_annotation
end

#type_nameTypeName (readonly) Also known as: name

Returns the value of attribute type_name.

Returns:



24
25
26
# File 'lib/rbs/ast/ruby/declarations.rb', line 24

def type_name
  @type_name
end

#type_name_locationLocation (readonly)

Returns the value of attribute type_name_location.

Returns:



20
21
22
# File 'lib/rbs/ast/ruby/declarations.rb', line 20

def type_name_location
  @type_name_location
end

Instance Method Details

#locationLocation

Returns:



43
44
45
46
47
48
49
50
51
52
53
# File 'lib/rbs/ast/ruby/declarations.rb', line 43

def location
  if type_annotation
    Location.new(
      type_name_location.buffer,
      type_name_location.start_pos,
      type_annotation.location.end_pos
    )
  else
    type_name_location
  end
end

#type_argsArray[Types::t] Also known as: args

Returns:

  • (Array[Types::t])


35
36
37
38
39
40
41
# File 'lib/rbs/ast/ruby/declarations.rb', line 35

def type_args
  if type_annotation
    type_annotation.type_args
  else
    []
  end
end

#type_fingerprintObject

Returns:

  • (Object)


58
59
60
61
62
63
# File 'lib/rbs/ast/ruby/declarations.rb', line 58

def type_fingerprint
  [
    type_name.to_s,
    type_annotation&.type_fingerprint
  ]
end