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:
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
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleantest(EK9Parser.IdentifierReferenceContext ctx, ISymbol symbol) Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface BiPredicate
and, negate, or
-
Constructor Details
-
CloseableEscapeDetector
CloseableEscapeDetector(SymbolsAndScopes symbolsAndScopes)
-
-
Method Details
-
test
- Specified by:
testin interfaceBiPredicate<EK9Parser.IdentifierReferenceContext, ISymbol>
-