Module: Solargraph::SourceMap::NodeProcessor

Defined in:
lib/solargraph/source_map/node_processor.rb,
lib/solargraph/source_map/node_processor/base.rb,
lib/solargraph/source_map/node_processor/def_node.rb,
lib/solargraph/source_map/node_processor/sym_node.rb,
lib/solargraph/source_map/node_processor/args_node.rb,
lib/solargraph/source_map/node_processor/defs_node.rb,
lib/solargraph/source_map/node_processor/send_node.rb,
lib/solargraph/source_map/node_processor/alias_node.rb,
lib/solargraph/source_map/node_processor/begin_node.rb,
lib/solargraph/source_map/node_processor/block_node.rb,
lib/solargraph/source_map/node_processor/casgn_node.rb,
lib/solargraph/source_map/node_processor/cvasgn_node.rb,
lib/solargraph/source_map/node_processor/gvasgn_node.rb,
lib/solargraph/source_map/node_processor/ivasgn_node.rb,
lib/solargraph/source_map/node_processor/lvasgn_node.rb,
lib/solargraph/source_map/node_processor/orasgn_node.rb,
lib/solargraph/source_map/node_processor/sclass_node.rb,
lib/solargraph/source_map/node_processor/resbody_node.rb,
lib/solargraph/source_map/node_processor/namespace_node.rb

Overview

The processor classes used by SourceMap::Mapper to generate pins from parser nodes.

Defined Under Namespace

Classes: AliasNode, ArgsNode, Base, BeginNode, BlockNode, CasgnNode, CvasgnNode, DefNode, DefsNode, GvasgnNode, IvasgnNode, LvasgnNode, NamespaceNode, OrasgnNode, ResbodyNode, SclassNode, SendNode, SymNode

Class Method Summary collapse

Class Method Details

.process(node, region = Region.new, pins = [], locals = []) ⇒ Array(Array<Pin::Base>, Array<Pin::Base>)


68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/solargraph/source_map/node_processor.rb', line 68

def self.process node, region = Region.new, pins = [], locals = []
  if pins.empty?
    pins.push Pin::Namespace.new(
      location: region.source.location,
      name: ''
    )
  end
  return [pins, locals] unless node.is_a?(Parser::AST::Node)
  klass = @@processors[node.type] || BeginNode
  processor = klass.new(node, region, pins, locals)
  processor.process
  [processor.pins, processor.locals]
end