Class: Solargraph::Parser::Rubyvm::NodeProcessors::KwArgNode
- Inherits:
-
NodeProcessor::Base
- Object
- NodeProcessor::Base
- Solargraph::Parser::Rubyvm::NodeProcessors::KwArgNode
- Defined in:
- lib/solargraph/parser/rubyvm/node_processors/kw_arg_node.rb
Instance Attribute Summary
Attributes inherited from NodeProcessor::Base
#locals, #node, #pins, #region
Instance Method Summary collapse
Methods inherited from NodeProcessor::Base
Constructor Details
This class inherits a constructor from Solargraph::Parser::NodeProcessor::Base
Instance Method Details
#process ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/solargraph/parser/rubyvm/node_processors/kw_arg_node.rb', line 8 def process locals.push Solargraph::Pin::Parameter.new( location: region.closure.location, closure: region.closure, comments: comments_for(node), name: node.children[0].children[0].to_s, # assignment: require_keyword?(node) ? nil : node.children[0].children[1], asgn_code: require_keyword?(node) ? nil: region.code_for(node.children[0].children[1]), presence: region.closure.location.range, decl: require_keyword?(node) ? :kwarg : :kwoptarg ) idx = region.closure.parameters.find_index { |par| [:kwrestarg, :blockarg].include?(par.decl) } if idx region.closure.parameters.insert idx, locals.last else region.closure.parameters.push locals.last end node.children[1] && NodeProcessor.process(node.children[1], region, pins, locals) end |