Class: Solargraph::Parser::Rubyvm::NodeProcessors::ArgsNode
- Inherits:
-
NodeProcessor::Base
- Object
- NodeProcessor::Base
- Solargraph::Parser::Rubyvm::NodeProcessors::ArgsNode
- Defined in:
- lib/solargraph/parser/rubyvm/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
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 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 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/solargraph/parser/rubyvm/node_processors/args_node.rb', line 8 def process if region.closure.is_a?(Pin::Method) || region.closure.is_a?(Pin::Block) if region.lvars[0].nil? node.children[0].times do |i| locals.push Solargraph::Pin::Parameter.new( location: region.closure.location, closure: region.closure, comments: comments_for(node), name: extract_name(node.children[i + 1]), presence: region.closure.location.range, decl: :arg ) region.closure.parameters.push locals.last end else node.children[0].times do |i| locals.push Solargraph::Pin::Parameter.new( location: region.closure.location, closure: region.closure, comments: comments_for(node), name: region.lvars[i].to_s, presence: region.closure.location.range, decl: :arg ) region.closure.parameters.push locals.last end end if node.children[6] locals.push Solargraph::Pin::Parameter.new( location: region.closure.location, closure: region.closure, comments: comments_for(node), name: node.children[6].to_s, presence: region.closure.location.range, decl: :restarg ) region.closure.parameters.push locals.last end if node.children[8] && node.children[8].children.first locals.push Solargraph::Pin::Parameter.new( location: region.closure.location, closure: region.closure, comments: comments_for(node), name: node.children[8].children.first.to_s, presence: region.closure.location.range, decl: :kwrestarg ) region.closure.parameters.push locals.last end end process_children if node.children.last locals.push Solargraph::Pin::Parameter.new( location: region.closure.location, closure: region.closure, comments: comments_for(node), name: node.children.last.to_s, presence: region.closure.location.range, decl: :blockarg ) region.closure.parameters.push locals.last end end |