Class: Solargraph::SourceMap::NodeProcessor::NamespaceNode
- Defined in:
- lib/solargraph/source_map/node_processor/namespace_node.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
Methods included from Solargraph::Source::NodeMethods
const_from, drill_signature, get_node_end_position, get_node_start_position, infer_literal_node_type, pack_name, resolve_node_signature, returns_from, unpack_name
Constructor Details
This class inherits a constructor from Solargraph::SourceMap::NodeProcessor::Base
Instance Method Details
#process ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/solargraph/source_map/node_processor/namespace_node.rb', line 5 def process visibility = :public if node.children[0].kind_of?(AST::Node) and node.children[0].children[0].kind_of?(AST::Node) and node.children[0].children[0].type == :cbase tree = pack_name(node.children[0]) tree.shift if tree.first.empty? else tree = region.namespace.empty? ? [] : [region.namespace] tree.concat pack_name(node.children[0]) end fqn = tree.join('::') sc = nil if node.type == :class and !node.children[1].nil? sc = unpack_name(node.children[1]) end pins.push Solargraph::Pin::Namespace.new(get_node_location(node), tree[0..-2].join('::') || '', pack_name(node.children[0]).last.to_s, comments_for(node), node.type, visibility) pins.push Pin::Reference::Superclass.new(pins.last.location, pins.last.path, sc) unless sc.nil? process_children region.update(namespace: fqn, scope: :instance, visibility: :public) end |