Class InputVarietyDenominatorRecorder

java.lang.Object
org.ek9lang.compiler.phase5.InputVarietyDenominatorRecorder
All Implemented Interfaces:
Consumer<org.antlr.v4.runtime.tree.ParseTree>

final class InputVarietyDenominatorRecorder extends Object implements Consumer<org.antlr.v4.runtime.tree.ParseTree>
Records the input-variation figures — the 1-wise FLOOR (headline) and the pairwise DENOMINATOR (ceiling) plus the per-leaf confidence — on each callable (method / function / operator), squirrelled for the metrics / MCP surface next to COMPLEXITY. This is the static, every-build half of the metric (design §2, §11.2), computed over the callable's flattened leaf dimensions (records decompose to fields, §4.6).

Advisory only — it emits no error: the metric is a floor detector and its optional gate is a later, packaging-stage concern. Built-in constructs (org.ek9. modules) are exempt (§6.4). Instance methods/operators score against the receiver as implicit p0 (§4.5); only a no-arg function or constructor (no receiver dimension) is exempt.

Scoping (§7 — both filters must pass, isOutOfScope(ISymbol)). A denominator is recorded only on the externally-testable public surface that carries directly-drivable body logic: private (and protected-on-non-open) callables are out (§7.1 visibility); and methods/operators on entry-shim / pure-data genera — program / service / text / application — are out (§7.2 construct-kind), their risk caught more cheaply by the coverage gate and locale-completeness errors. Because the numerator probe and the report both key off the squirrelled INPUT_VARIETY_FLOOR (they reuse this one scoping decision rather than re-deriving it — see CoverageProbePlacer), an excluded construct produces no floor, no probe and no report row. Dynamic functions/classes never reach the recorder (different grammar rules), so they need no explicit filter here.

  • Constructor Details

    • InputVarietyDenominatorRecorder

      InputVarietyDenominatorRecorder(SymbolsAndScopes symbolsAndScopes)
  • Method Details

    • accept

      public void accept(org.antlr.v4.runtime.tree.ParseTree node)
      Specified by:
      accept in interface Consumer<org.antlr.v4.runtime.tree.ParseTree>
    • record

      void record(ISymbol symbol)
      The squirrel core — package-private so it is unit-testable with a hand-built callable, no parse tree or scope resolution required.