Class InjectionTypeCounter

java.lang.Object
org.ek9lang.compiler.phase5.InjectionTypeCounter

final class InjectionTypeCounter extends Object
Parallel to InjectionCounter, but tracks the DISTINCT injected component TYPE (fully-qualified names) per scope rather than just the site count. Pushed/popped in lockstep with InjectionCounter at each component/callable scope during the AST traversal; recordType(String) adds the type of a '!' (BANG) injection to the innermost open scope.

Feeds two design checks: E11043 (too many distinct injected components in one callable) reads a callable scope's set size on pop; E11041 (the same component re-injected across multiple methods of a component/class) folds each method's popped set into a per-construct tally.

  • Constructor Details

    • InjectionTypeCounter

      InjectionTypeCounter()
  • Method Details

    • pushScope

      void pushScope()
      Push a new scope with an empty set of injected type names.
    • popScope

      Set<String> popScope()
      Pop the innermost scope and return its distinct injected type names.
    • recordType

      void recordType(String typeFullyQualifiedName)
      Record an injected component type for the innermost open scope, if one is open. A '!' injection can also appear as a component property outside any callable scope, in which case the enclosing component scope captures it (and that scope is discarded by the E11043 path, since field-level injection is E11040's domain).