Class OrderingResultSources

All Implemented Interfaces:
org.antlr.v4.runtime.tree.ParseTreeListener, EK9Listener

final class OrderingResultSources extends ScopeStackConsistencyListener
The per-source half of OrderingTotality (E07188): for every method, operator and function that returns an Integer, finds where the returning variable can get its value and records the PARTIAL sources - an unset Integer(), a <=> of a partial type, a call of another callable (decided later, once every source has been walked). Holds no state of its own beyond the shared collector, so it is safe in the phase's parallel per-source walk.

THE reading of "where can the returning variable get its value": its initialiser and every plain assignment to it anywhere in the body (:, :=, :=?), and for a local variable named by a source, that variable's own initialiser and assignments. The assignments are taken without regard to order; the INITIALISER of a returning variable (the callable's, or a switch, try or loop expression's) is left out when every path gives the variable a new value - the same definite-assignment analysis as E08050, on the same branch pull-ups (IfStatementOrError, SwitchStatementOrError, TryStatementOrError, ForStatementOrError, WhileStatementOrError, reused as ConstructorFieldInitialisationListener reuses them), asked through SymbolsAndScopes.isInitialiserReplaced. So <- rtn as Integer: Integer() followed by an if/else that assigns on every arm is total; without the else it is not.