Class: Solargraph::SourceMap::NodeProcessor::ArgsNode

Inherits:
Base
  • Object
show all
Defined in:
lib/solargraph/source_map/node_processor/args_node.rb

Instance Attribute Summary

Attributes inherited from Base

#node, #pins, #region

Instance Method Summary collapse

Methods inherited from Base

#initialize

Methods included from Solargraph::Source::NodeMethods

const_from, drill_signature, get_node_end_position, get_node_start_position, infer_literal_node_type, pack_name, resolve_node_signature, returns_from, unpack_name

Constructor Details

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

Instance Method Details

#processObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/solargraph/source_map/node_processor/args_node.rb', line 5

def process
  return if node.children.empty?
  here = get_node_start_position(node)
  context = named_path_pin(here)
  block = block_pin(here)
  if block.kind == Solargraph::Pin::BLOCK
    pi = 0
    node.children.each do |u|
      pins.push Solargraph::Pin::BlockParameter.new(get_node_location(u), region.namespace, "#{u.children[0]}", comments_for(node), block)
      block.parameters.push pins.last
      pi += 1
    end
  else
    node.children.each do |u|
      presence = Range.new(here, block.location.range.ending)
      pins.push Solargraph::Pin::MethodParameter.new(get_node_location(u), region.namespace, u.children[0].to_s, comments_for(node), u.children[1], infer_literal_node_type(u.children[1]), context, block, presence)
    end
  end
  process_children
end