Class: Solargraph::Parser::Rubyvm::NodeProcessors::BlockNode

Inherits:
NodeProcessor::Base show all
Includes:
Solargraph::Parser::Rubyvm::NodeMethods
Defined in:
lib/solargraph/parser/rubyvm/node_processors/block_node.rb

Instance Attribute Summary

Attributes inherited from NodeProcessor::Base

#locals, #node, #pins, #region

Instance Method Summary collapse

Methods included from Solargraph::Parser::Rubyvm::NodeMethods

any_splatted_call?, call_nodes_from, const_nodes_from, convert_hash, find_recipient_node, infer_literal_node_type, node?, pack_name, returns_from, splatted_call?, splatted_hash?, splatted_node?, unpack_name

Methods inherited from NodeProcessor::Base

#initialize

Constructor Details

This class inherits a constructor from Solargraph::Parser::NodeProcessor::Base

Instance Method Details

#processObject



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/solargraph/parser/rubyvm/node_processors/block_node.rb', line 10

def process
  if other_class_eval?
    other_class = Solargraph::Pin::Namespace.new(
      type: :class,
      name: unpack_name(node.children[0].children[0])
    )
    make_block_in other_class.context
    process_children region.update(closure: other_class)
  else
    make_block_in nil
    process_children region.update(closure: pins.last)
  end
end