Module: Jade::Frontend::UsageAnalysis
- Extended by:
- UsageAnalysis
- Included in:
- UsageAnalysis
- Defined in:
- lib/jade/frontend/usage_analysis.rb,
lib/jade/frontend/usage_analysis/reference_index.rb
Overview
Walks a resolved AST and builds a ReferenceIndex of where each symbol is used. Runs after SemanticAnalysis (which attaches symbols) and before TypeChecking. Never fails — attaches ‘usage_index` to the entry and returns it.
Reference kinds:
:called - in callee position of a FunctionCall
:as_value - bare reference (passed as value, returned, etc.)
:constructed - constructor applied with args
:pattern_match - constructor used in a pattern match
:type_annotation - type appearing in a signature, variant args,
struct fields, interface signatures, etc.
:exposed - name listed in `module M exposing (...)`
Defined Under Namespace
Classes: Reference, ReferenceIndex
Instance Method Summary collapse
Instance Method Details
#analyze(entry, _registry) ⇒ Object
21 22 23 24 25 26 |
# File 'lib/jade/frontend/usage_analysis.rb', line 21 def analyze(entry, _registry) walk(entry.ast, :as_value, entry) .group_by(&:symbol_key) .freeze .then { entry.with(usage_index: ReferenceIndex.new(references: it)) } end |