Class: Solargraph::Parser::Legacy::NodeProcessors::ArgsNode

Inherits:
NodeProcessor::Base show all
Defined in:
lib/solargraph/parser/legacy/node_processors/args_node.rb

Instance Attribute Summary

Attributes inherited from NodeProcessor::Base

#locals, #node, #pins, #region

Instance Method Summary collapse

Methods inherited from NodeProcessor::Base

#initialize

Constructor Details

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

Instance Method Details

#processObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/solargraph/parser/legacy/node_processors/args_node.rb', line 8

def process
  node.children.each do |u|
    loc = get_node_location(u)
    locals.push Solargraph::Pin::Parameter.new(
      location: loc,
      closure: region.closure,
      comments: comments_for(node),
      name: u.children[0].to_s,
      assignment: u.children[1],
      asgn_code: u.children[1] ? region.code_for(u.children[1]) : nil,
      presence: region.closure.location.range,
      decl: get_decl(u)
    )
    region.closure.parameters.push locals.last
  end
  process_children
end