Class UnusedCaptureOrError

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

final class UnusedCaptureOrError extends Object implements Consumer<org.antlr.v4.runtime.tree.ParseTree>
Detects unused captured variables in dynamic functions and classes (E11018).

Captured variables that are declared but never referenced in the body indicate unnecessary coupling to the enclosing scope. Remove the capture to clarify the dynamic function's actual dependencies.

Exemptions:

  • Abstract dynamic functions - no body to reference captures in
  • Defaulted (compiler-generated) dynamic functions
  • Externally implemented (Java-backed) dynamic functions
  • Constructor Details

  • 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>