Class SafeAccessWithdrawal
ProvenContainerChange decides what may): from that point on, in the current scope and every
scope enclosing it, get() / ok() / error() / next() needs a new check. So
if name? then forget(name) then name.get() is E08030 at the get(), and so is a second
it.next() after one it.hasNext().
Branches of one if / switch are exclusive: a change in one branch is withheld from its siblings
(never from the code after the statement) - the enclosing scopes take it when the statement ends
(enterBranches(Collection) / exitBranches()). A loop is read AHEAD (enterLoop(ParseTree, Predicate)): a change anywhere in its
body may come before an access on the next pass, so what the loop may change is withdrawn before it is entered.
The walk follows the order things RUN in, where that differs from the order they are written: what the target of
an assignment does (this :=: from.get(), alias :=: Optional(name.get())) is done after its
right-hand side (enterAssignment()), and a proof a construct makes from its own condition was made looking
ahead over that condition (holdOwnProofs(IScope, ParseTree)), so walking the condition does not withdraw it.
-
Constructor Summary
ConstructorsConstructorDescriptionSafeAccessWithdrawal(SymbolsAndScopes symbolsAndScopes, ProvenContainerChange provenContainerChange, ContainerChangedBetween containerChangedBetween) -
Method Summary
Modifier and TypeMethodDescription(package private) voidAn assignment statement begins: what its target does is withdrawn when its right-hand side has run.(package private) voidenterBranches(Collection<IScope> branchScopes) Anif/switchbegins;branchScopesare the scopes of its exclusive branches.(package private) voidA loop is about to be entered: what its body (or its condition) may change is withdrawn now, before any of it is walked - a change late in the body comes before an access early in it on the next pass.(package private) voidThe assignment statement has run: what its target does is withdrawn now.(package private) voidTheif/switchhas ended: what any branch withdrew holds after it.(package private) voidexitRule(org.antlr.v4.runtime.tree.ParseTree node) A part of the tree has been walked: if it ends a held condition, the hold ends.(package private) voidholdOwnProofs(IScope scope, org.antlr.v4.runtime.tree.ParseTree end) A construct has just made its proofs in its ownscopefrom its condition, looking ahead over it toend(ConstructSafeAccessMarker.conditionEndOf): while that condition is walked, nothing is withdrawn fromscope(the enclosing scopes still are).(package private) voidoccurrence(ISymbol occurrenceSymbol, List<ObjectSharing.Use> uses, boolean assignmentTarget) One occurrence of a variable, with what it does to the object (ProvenContainerChange.usesOf(EK9Parser.IdentifierContext, ISymbol)): withdraw every proof that may break.(package private) voidA place where code of the program's own runs (ProgramCodeSites): withdraw what it may change - beyond the names a call is given (those are their own occurrences), and the names an in-place write or an iteration changes in place.(package private) voidThe right-hand side of the innermost open assignment statement begins.
-
Constructor Details
-
SafeAccessWithdrawal
SafeAccessWithdrawal(SymbolsAndScopes symbolsAndScopes, ProvenContainerChange provenContainerChange, ContainerChangedBetween containerChangedBetween)
-
-
Method Details
-
occurrence
One occurrence of a variable, with what it does to the object (ProvenContainerChange.usesOf(EK9Parser.IdentifierContext, ISymbol)): withdraw every proof that may break. The occurrence that is theassignmentTargetitself (aliasinalias :=: Optional(name.get())) acts once the right-hand side has run. -
programCode
A place where code of the program's own runs (ProgramCodeSites): withdraw what it may change - beyond the names a call is given (those are their own occurrences), and the names an in-place write or an iteration changes in place. An in-place write in an assignment's target is the assignment's own operator, which runs once the right-hand side has. -
enterAssignment
void enterAssignment()An assignment statement begins: what its target does is withdrawn when its right-hand side has run. -
rightHandSideBegins
void rightHandSideBegins()The right-hand side of the innermost open assignment statement begins. -
exitAssignment
void exitAssignment()The assignment statement has run: what its target does is withdrawn now. -
enterLoop
void enterLoop(org.antlr.v4.runtime.tree.ParseTree loop, Predicate<ISymbol> reprovedOnEveryLaterPass) A loop is about to be entered: what its body (or its condition) may change is withdrawn now, before any of it is walked - a change late in the body comes before an access early in it on the next pass. Except whatreprovedOnEveryLaterPass: the trailing condition of ado/whilethat proves it again. -
holdOwnProofs
A construct has just made its proofs in its ownscopefrom its condition, looking ahead over it toend(ConstructSafeAccessMarker.conditionEndOf): while that condition is walked, nothing is withdrawn fromscope(the enclosing scopes still are). -
exitRule
void exitRule(org.antlr.v4.runtime.tree.ParseTree node) A part of the tree has been walked: if it ends a held condition, the hold ends. -
enterBranches
Anif/switchbegins;branchScopesare the scopes of its exclusive branches. -
exitBranches
void exitBranches()Theif/switchhas ended: what any branch withdrew holds after it.
-