Module: Jade::Frontend::UnusedAnalysis

Extended by:
UnusedAnalysis
Included in:
UnusedAnalysis
Defined in:
lib/jade/frontend/unused_analysis.rb

Overview

Emits a warning per module-private function that no reference in the module’s own usage_index touches. Runs after UsageAnalysis so it can read the index. Never fails; only appends to diagnostics.

Scope is intentionally narrow: only Symbol::Function for now. Other kinds (Constructor, Variant, Union, Struct, InterfaceFunction) need separate filter rules — e.g. variants are reachable via pattern match, interface fns are dispatched, not directly called — and are deferred.

Instance Method Summary collapse

Instance Method Details

#analyze(entry, _registry) ⇒ Object



15
16
17
18
19
20
21
22
# File 'lib/jade/frontend/unused_analysis.rb', line 15

def analyze(entry, _registry)
  entry
    .defined_values
    .values
    .select { unused?(it, entry) }
    .reduce(entry.diagnostics) { |list, sym| list.add(warning(sym, entry)) }
    .then { entry.with(diagnostics: it) }
end