Class AbstractSafeGenericAccessMarker
java.lang.Object
org.ek9lang.compiler.phase5.AbstractSafeGenericAccessMarker
- Direct Known Subclasses:
ForLoopSafeGenericAccessMarker, IfBlockSafeGenericAccessMarker, SwitchBlockSafeGenericAccessMarker, TernaryBlockSafeGenericAccessMarker, TryBlockSafeGenericAccessMarker, WhileLoopSafeGenericAccessMarker
Does checks on the control part of a while loop to see if Optional/Result/Iterator are now safe via method access.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionAbstractSafeGenericAccessMarker(SymbolsAndScopes symbolsAndScopes, ErrorListener errorListener) Constructor to provided typed access. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidprocessExpression(EK9Parser.ExpressionContext ctx, IScope wouldBeSafeScope) Each top-levelandconjunct of the control that is an is-set check proves its subject safe inwouldBeSafeScope, whatever the other conjuncts are (SafeAccessConjuncts, decision Q3).protected voidprocessPreFlow(EK9Parser.PreFlowStatementContext ctx, IScope wouldBeSafeScope) The pre-flow's subject is safe in the construct ONLY when the pre-flow is a guard that skips the construct when the subject is unset (<-,:=?-PreFlowCanSkipBody).
-
Field Details
-
symbolsAndScopes
-
-
Constructor Details
-
AbstractSafeGenericAccessMarker
AbstractSafeGenericAccessMarker(SymbolsAndScopes symbolsAndScopes, ErrorListener errorListener) Constructor to provided typed access.
-
-
Method Details
-
processPreFlow
The pre-flow's subject is safe in the construct ONLY when the pre-flow is a guard that skips the construct when the subject is unset (<-,:=?-PreFlowCanSkipBody). A plain:=checks nothing:if o := empty() then gateran its body with an emptyoando.get()threw. Before marking, a pre-flow that re-points a subject the scope AROUND the construct has already proven safe is E08040 - judged here, because the construct's own marking would hide it. -
processExpression
Each top-levelandconjunct of the control that is an is-set check proves its subject safe inwouldBeSafeScope, whatever the other conjuncts are (SafeAccessConjuncts, decision Q3).
-