Class: RBS::AST::Ruby::Members::DefMember

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

Constant Summary collapse

Overload =
AST::Members::MethodDefinition::Overload

Instance Attribute Summary collapse

Attributes inherited from Base

#buffer

Instance Method Summary collapse

Methods included from Helpers::LocationHelper

#rbs_location

Constructor Details

#initialize(buffer, name, node, method_type, leading_comment) ⇒ DefMember

Returns a new instance of DefMember.



555
556
557
558
559
560
561
# File 'lib/rbs/ast/ruby/members.rb', line 555

def initialize(buffer, name, node, method_type, leading_comment)
  super(buffer)
  @name = name
  @node = node
  @method_type = method_type
  @leading_comment = leading_comment
end

Instance Attribute Details

#leading_commentObject (readonly)

Returns the value of attribute leading_comment.



553
554
555
# File 'lib/rbs/ast/ruby/members.rb', line 553

def leading_comment
  @leading_comment
end

#method_typeObject (readonly)

Returns the value of attribute method_type.



552
553
554
# File 'lib/rbs/ast/ruby/members.rb', line 552

def method_type
  @method_type
end

#nameObject (readonly)

Returns the value of attribute name.



550
551
552
# File 'lib/rbs/ast/ruby/members.rb', line 550

def name
  @name
end

#nodeObject (readonly)

Returns the value of attribute node.



551
552
553
# File 'lib/rbs/ast/ruby/members.rb', line 551

def node
  @node
end

Instance Method Details

#annotationsObject



575
576
577
# File 'lib/rbs/ast/ruby/members.rb', line 575

def annotations
  []
end

#locationObject



563
564
565
# File 'lib/rbs/ast/ruby/members.rb', line 563

def location
  rbs_location(node.location)
end

#name_locationObject



579
580
581
# File 'lib/rbs/ast/ruby/members.rb', line 579

def name_location
  rbs_location(node.name_loc)
end

#overloading?Boolean

Returns:

  • (Boolean)


571
572
573
# File 'lib/rbs/ast/ruby/members.rb', line 571

def overloading?
  method_type.overloading?
end

#overloadsObject



567
568
569
# File 'lib/rbs/ast/ruby/members.rb', line 567

def overloads
  method_type.overloads
end

#type_fingerprintObject



583
584
585
586
587
588
589
590
# File 'lib/rbs/ast/ruby/members.rb', line 583

def type_fingerprint
  [
    "members/def",
    name.to_s,
    method_type.type_fingerprint,
    leading_comment&.as_comment&.string
  ]
end