Class CloseableEscapeDetector

java.lang.Object
org.ek9lang.compiler.phase5.CloseableEscapeDetector
All Implemented Interfaces:
BiPredicate<EK9Parser.IdentifierReferenceContext, ISymbol>

final class CloseableEscapeDetector extends Object implements BiPredicate<EK9Parser.IdentifierReferenceContext, ISymbol>
Detects if a closeable variable is being used in an "escape context" where ownership is transferred elsewhere. This is used for Rule 2 (E81056) to determine if a resource needs to be explicitly closed.
Escape contexts include:
  • Passed as argument to a method/function call
  • Assigned to a return variable
  • Assigned to a field
  • Added to a collection via += operator