Class SafeAccessRepointOrError
java.lang.Object
org.ek9lang.compiler.common.RuleSupport
org.ek9lang.compiler.common.TypedSymbolAccess
org.ek9lang.compiler.phase5.SafeSymbolAccess
org.ek9lang.compiler.phase5.SafeAccessRepointOrError
THE E08040 rule: an Optional/Result/Iterator that is proven safe to unwrap in the current scope must not be
re-pointed there, by ANY store - an assignment statement (
o: other, o :=? other) or a
construct's assignment pre-flow (if o := other then o?). The o.get() the safe scope allows
would read the NEW value, which nothing checked (it threw 'No such element').
A store that IS the pre-flow of a construct (if/while/for/switch/try o := other) is not judged where
it appears: while, for, switch and try mark their WHOLE scope safe for the
pre-flow's own subject, so at the store the subject already reads as safe - by itself. The construct's marker
judges its pre-flow instead, BEFORE it marks (ConstructSafeAccessMarker), against the scope
around the construct. IsConstructPreFlow is the one test for that position.
-
Field Summary
Fields inherited from class SafeSymbolAccess
safeGenericAccessMarker, safeGenericAccessPredicateFields inherited from class RuleSupport
errorListener, symbolsAndScopes -
Constructor Summary
ConstructorsConstructorDescriptionSafeAccessRepointOrError(SymbolsAndScopes symbolsAndScopes, ErrorListener errorListener) -
Method Summary
Modifier and TypeMethodDescription(package private) voidA construct's pre-flow, judged by its marker before the marker makes the construct safe.(package private) voidReport E08040 atopiftargetis proven safe to unwrap in the current scope.Methods inherited from class SafeSymbolAccess
isAccessUnSafe, requiresSafeAccessMethods inherited from class TypedSymbolAccess
emitTypeNotResolvedError, getRecordedAndTypedSymbol, isAlreadyInError, isProcessingScopePure, isPureReassignmentDisallowed, recordATypedSymbol
-
Constructor Details
-
SafeAccessRepointOrError
SafeAccessRepointOrError(SymbolsAndScopes symbolsAndScopes, ErrorListener errorListener)
-
-
Method Details
-
accept
Report E08040 atopiftargetis proven safe to unwrap in the current scope. -
accept
A construct's pre-flow, judged by its marker before the marker makes the construct safe. A declaration (if o <- value) makes a new variable, so only an assignment re-points.
-