class Solargraph::Parser::Rubyvm::NodeProcessors::ResbodyNode

Public Instance Methods

process() click to toggle source
# File lib/solargraph/parser/rubyvm/node_processors/resbody_node.rb, line 9
def process
  presence = Range.from_node(node)
  loc = get_node_location(node.children[1])
  if node.children[1] && node.children[1].children.first
    types = if !node.children.first || node.children.first.children.empty?
              ['Exception']
            else
              node.children.first.children[0..-2].map do |child|
                unpack_name(child)
              end
            end
    if exception_variable?
      locals.push Solargraph::Pin::LocalVariable.new(
        location: loc,
        closure: region.closure,
        name: node.children[1].children.first.children.first.to_s,
        comments: "@type [#{types.join(',')}]",
        presence: presence
      )
    end
  end
  NodeProcessor.process(node.children[1], region, pins, locals)
end

Private Instance Methods

exception_variable?() click to toggle source
# File lib/solargraph/parser/rubyvm/node_processors/resbody_node.rb, line 35
def exception_variable?
  Parser.is_ast_node?(node.children[1]) &&
    Parser.is_ast_node?(node.children[1].children.first) &&
    node.children[1].children.first.type == :LASGN
end