class Orbacle::Indexer
Constants
- QueueElement
Attributes
logger[R]
Public Class Methods
new(logger, stats)
click to toggle source
# File lib/orbacle/indexer.rb, line 104 def initialize(logger, stats) @logger = logger @stats = stats end
Public Instance Methods
call(project_root:)
click to toggle source
# File lib/orbacle/indexer.rb, line 109 def call(project_root:) project_root_path = Pathname.new(project_root) files = Dir.glob("#{project_root_path}/**/*.rb") id_generator = IntegerIdGenerator.new worklist = Worklist.new state = GlobalTree.new(id_generator) graph = Graph.new DefineBuiltins.new(graph, state, id_generator).() @parser = Builder.new(graph, worklist, state, id_generator) queue_contents = Queue.new queue_asts = Queue.new logger.info "Reading..." reading_process = ReadingProcess.new(logger, queue_contents, files) @stats.measure(:reading) { reading_process.call() } logger.info "Parsing..." parsing_process = ParsingProcess.new(logger, queue_contents, queue_asts) @stats.measure(:parsing) { parsing_process.call() } logger.info "Building graph..." building_process = BuildingProcess.new(queue_asts, @parser) @stats.measure(:building) { building_process.call() } logger.info "Typing..." typing_service = TypingService.new(logger, @stats) @stats.measure(:typing) { typing_service.(graph, worklist, state) } type_mapping = state.instance_variable_get(:@type_mapping) @stats.set_value(:typed_nodes_all, type_mapping.size) @stats.set_value(:typed_nodes_not_bottom, type_mapping.count {|k,v| !v.bottom? }) @stats.set_value(:typed_nodes_call_result, type_mapping.count {|k,v| k.type == :call_result }) @stats.set_value(:typed_nodes_call_result_not_bottom, type_mapping.count {|k,v| k.type == :call_result && !v.bottom? }) return state, graph, worklist end