Class ThrowFreeStatement
java.lang.Object
org.ek9lang.compiler.phase5.ThrowFreeStatement
- All Implemented Interfaces:
Predicate<EK9Parser.BlockStatementContext>
THE test that a block statement cannot throw: it only stores a literal, or the value a variable already holds,
into a variable of exactly the same type (
size := limit, count <- 0, total as Integer?).
Nothing is called - no function, method, operator, constructor or promotion - so no exception can leave it.
The flow analysis asks it inside a try: a variable stored by such a statement before anything that may throw
holds its new value at every point an exception can leave the try, so its pre-try value never reaches the catch
or the finally (ValueTrackingAnalyzer.enterStatement). Anything else is assumed to throw, which is
always sound - a value the handler cannot see is never claimed to reach it, only kept as one that may.
-
Constructor Details
-
ThrowFreeStatement
ThrowFreeStatement(SymbolsAndScopes symbolsAndScopes)
-
-
Method Details
-
test
- Specified by:
testin interfacePredicate<EK9Parser.BlockStatementContext>
-