Class: Woods::Ast::CallSiteExtractor
- Inherits:
-
Object
- Object
- Woods::Ast::CallSiteExtractor
- Defined in:
- lib/woods/ast/call_site_extractor.rb
Overview
Extracts call sites from an AST node tree.
Returns method calls found in the tree, ordered by source line number. Used by both RubyAnalyzer (call graph building) and FlowAssembler (execution flow ordering).
Instance Method Summary collapse
-
#extract(node) ⇒ Array<Hash>
Extract all call sites from an AST node, ordered by line number.
-
#extract_significant(node, known_units: []) ⇒ Array<Hash>
Extract only significant call sites, filtering out noise.
Instance Method Details
#extract(node) ⇒ Array<Hash>
Extract all call sites from an AST node, ordered by line number.
50 51 52 53 54 |
# File 'lib/woods/ast/call_site_extractor.rb', line 50 def extract(node) calls = [] collect_calls(node, calls) calls.sort_by { |c| c[:line] } end |
#extract_significant(node, known_units: []) ⇒ Array<Hash>
Extract only significant call sites, filtering out noise.
61 62 63 64 65 66 67 68 69 |
# File 'lib/woods/ast/call_site_extractor.rb', line 61 def extract_significant(node, known_units: []) calls = extract(node) known_set = Set.new(known_units) calls.reject do |call| INSIGNIFICANT_METHODS.include?(call[:method_name]) && (known_units.empty? || !known_set.include?(call[:receiver])) end end |