Class: Solargraph::Parser::ParserGem::NodeProcessors::SendNode

Inherits:
NodeProcessor::Base show all
Includes:
Solargraph::Parser::ParserGem::NodeMethods
Defined in:
lib/solargraph/parser/parser_gem/node_processors/send_node.rb

Constant Summary

Constants included from Solargraph::Parser::ParserGem::NodeMethods

Solargraph::Parser::ParserGem::NodeMethods::NIL_NODE

Instance Attribute Summary

Attributes inherited from NodeProcessor::Base

#locals, #node, #pins, #region

Instance Method Summary collapse

Methods included from Solargraph::Parser::ParserGem::NodeMethods

any_splatted_call?, call_nodes_from, const_nodes_from, convert_hash, drill_signature, find_recipient_node, get_node_end_position, get_node_start_position, infer_literal_node_type, pack_name, repaired_find_recipient_node, returns_from_method_body, splatted_call?, splatted_hash?, unpack_name, value_position_nodes_only

Methods inherited from NodeProcessor::Base

#initialize

Constructor Details

This class inherits a constructor from Solargraph::Parser::NodeProcessor::Base

Instance Method Details

#processObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/solargraph/parser/parser_gem/node_processors/send_node.rb', line 10

def process
  # @sg-ignore Variable type could not be inferred for method_name

  # @type [Symbol]

  method_name = node.children[1]
  # :nocov:

  unless method_name.instance_of?(Symbol)
    Solargraph.assert_or_log(:parser_method_name, "Expected method name to be a Symbol, got #{method_name.class} for node #{node.inspect}")
    return process_children
  end
  # :nocov:

  if node.children[0].nil?
    if [:private, :public, :protected].include?(method_name)
      process_visibility
    elsif method_name == :module_function
      process_module_function
    elsif [:attr_reader, :attr_writer, :attr_accessor].include?(method_name)
      process_attribute
    elsif method_name == :include
      process_include
    elsif method_name == :extend
      process_extend
    elsif method_name == :prepend
      process_prepend
    elsif method_name == :require
      process_require
    elsif method_name == :autoload
      process_autoload
    elsif method_name == :private_constant
      process_private_constant
    # @sg-ignore

    elsif method_name == :alias_method && node.children[2] && node.children[2] && node.children[2].type == :sym && node.children[3] && node.children[3].type == :sym
      process_alias_method
    # @sg-ignore

    elsif method_name == :private_class_method && node.children[2].is_a?(AST::Node)
      # Processing a private class can potentially handle children on its own

      return if process_private_class_method
    end
  # @sg-ignore

  elsif method_name == :require && node.children[0].to_s == '(const nil :Bundler)'
    pins.push Pin::Reference::Require.new(Solargraph::Location.new(region.filename, Solargraph::Range.from_to(0, 0, 0, 0)), 'bundler/require', source: :parser)
  end
  process_children
end