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

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

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.



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_locationObject (readonly)

Returns the value of attribute operator_location.



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

def operator_location
  @operator_location
end

#type_annotationObject (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_nameObject (readonly) Also known as: name

Returns the value of attribute type_name.



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

def type_name
  @type_name
end

#type_name_locationObject (readonly)

Returns the value of attribute type_name_location.



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

def type_name_location
  @type_name_location
end

Instance Method Details

#locationObject



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_argsObject Also known as: args



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



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