class Solargraph::Parser::NodeProcessor::Base
Attributes
@return [Array<Pin::LocalVariable>]
@return [Parser::AST::Node]
@return [Array<Pin::Base>]
@return [Region]
Public Class Methods
Source
# File lib/solargraph/parser/node_processor/base.rb, line 23 def initialize node, region, pins, locals @node = node @region = region @pins = pins @locals = locals @processed_children = false end
@param node [Parser::AST::Node] @param region [Region] @param pins [Array<Pin::Base>] @param locals [Array<Pin::LocalVariable>]
Public Instance Methods
Source
# File lib/solargraph/parser/node_processor/base.rb, line 35 def process process_children true end
Subclasses should override this method to generate new pins.
@return [Boolean] continue processing the next processor of the same node type. @return [void] In case there is only one processor registered for the node type, it can be void.
Private Instance Methods
Source
# File lib/solargraph/parser/node_processor/base.rb, line 78 def block_pin position # @todo determine if this can return a Pin::Block pins.select { |pin| pin.is_a?(Pin::Closure) && pin.location.range.contain?(position) }.last end
@todo Candidate for deprecation @param position [Solargraph::Position] @return [Pin::Closure, nil]
Source
# File lib/solargraph/parser/node_processor/base.rb, line 86 def closure_pin position pins.select { |pin| pin.is_a?(Pin::Closure) && pin.location.range.contain?(position) }.last end
@todo Candidate for deprecation @param position [Solargraph::Position] @return [Pin::Closure, nil]
Source
# File lib/solargraph/parser/node_processor/base.rb, line 63 def comments_for(node) region.source.comments_for(node) end
@param node [Parser::AST::Node] @return [String, nil]
Source
# File lib/solargraph/parser/node_processor/base.rb, line 56 def get_node_location(node) range = Parser.node_range(node) Location.new(region.filename, range) end
@param node [Parser::AST::Node] @return [Solargraph::Location]
Source
# File lib/solargraph/parser/node_processor/base.rb, line 69 def named_path_pin position pins.select do |pin| pin.is_a?(Pin::Closure) && pin.path && !pin.path.empty? && pin.location.range.contain?(position) end.last end
@param position [Solargraph::Position] @return [Pin::Closure, nil]
Source
# File lib/solargraph/parser/node_processor/base.rb, line 45 def process_children subregion = region return if @processed_children @processed_children = true node.children.each do |child| next unless Parser.is_ast_node?(child) NodeProcessor.process(child, subregion, pins, locals) end end
@param subregion [Region] @return [void]