Class CloseableArgumentKeeping
A constructor that stores its own parameter in a closeable property (held: res) takes ownership of the
argument: the holder's operator close will close it. That is a transfer, and it is right only when the
caller hands over a NEW value - Holder(Res("x")). Handing it a value that already has an owner - a try
resource, a parameter, another object's property - gives that one resource two owners, and both close it
(try -> res <- Res() / holder <- Holder(res) closed res twice).
Collected while every source is walked (Walk 1, in parallel), decided once all have been (check()): a
constructor in one file is called in another, and a constructor that passes its own parameter on to
super(...), this(...) or another keeping constructor keeps it too, which is a fixpoint over all of
them. A member of a parameterised type is judged by the generic's own constructor
(GenericTemplateMember).
The same record serves EVERY user callable (the lane callee-keep, Steve's rule B + decision A, 2026-10-21): what a
method, operator, function or dynamic function does with each of its parameters is read with the same occurrence
reading as a constructor's (CallableParameterOccurrences, over ObjectSharing.all), and the answer is
DERIVED as RETAINS rules in the vocabulary a built-in declares - receiver <- item (kept in a property),
<otherParam> <- item (added to what another argument refers to), ambient <- item (held where
nothing here can name it) - so ReturnRetention.retainsArgument reads a user callable exactly as it reads a
built-in. They are closed to a fixpoint across calls (a callee forwarding to a callee that keeps) and unioned over
every override of a declaration (ReceiverInteriorReturns.overriddenBy); an abstract declaration nothing
implements cannot say, so it keeps every argument.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static enumWhat a construction does with the argument it is given at one position - decided only after every source has been walked (check()).(package private) static final recordA variable of one callable's body - one of its parameters, or a local that may refer to the same object - compared by identity. -
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final StringWhere a kept argument ends up when nothing more precise is known: held where nothing here can name it.(package private) static final StringWhere an argument stored in a property of the object ends up.(package private) static final StringThe argument is held by what the callable returns: handed back, not kept beyond the result. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) voidaliases(CloseableArgumentKeeping.Holder from, ISymbol to) The localtonow refers to the same object asfrom.(package private) voidcheck()After every source has been walked: close the kept set over the forwards, derive what every callable keeps, then report every construction that hands a kept parameter a value that is not new.(package private) voiddeclared(ScopedSymbol callable) A callable that was walked: what it does with each of its parameters is then known.(package private) CloseableArgumentKeeping.FatefateOf(MethodSymbol target, int index) What the constructor does with the argument given atindex.(package private) voidforwards(MethodSymbol constructor, int fromIndex, MethodSymbol target, int toIndex) The constructor passes its own parameter atfromIndextotargetattoIndex: if the target keeps it, so does this constructor.(package private) voidforwardsOpen(CloseableArgumentKeeping.Holder from, MethodSymbol target, int toIndex) The variable is passed on, whole, totarget's parameter: if that keeps it, so does this callable.(package private) voidkeeps(MethodSymbol constructor, int index) The constructor stores its parameter atindexin a closeable property of the object it constructs.(package private) voidkeepsOpen(CloseableArgumentKeeping.Holder holder, String destination) (package private) voidnotFresh(MethodSymbol target, int index, ErrorListener errorListener, IToken location, String argument) A construction is given a closeable value that is not new atindex: an error when the constructor keeps that parameter.(package private) voidpassedToCall(CloseableArgumentKeeping.Holder from, ScopedSymbol callee, int argumentIndex) The variable is passed, whole, to a method or function of the program's own.(package private) voidreceiverPassed(CloseableArgumentKeeping.Holder from, ScopedSymbol callee) The object a method runs on -Holder.of(method, null), its receiver - is passed on, as the receiver, to a method of the program's own: if that method keeps ITS receiver, so does this one.
-
Field Details
-
AMBIENT
Where a kept argument ends up when nothing more precise is known: held where nothing here can name it.- See Also:
-
RECEIVER
Where an argument stored in a property of the object ends up.- See Also:
-
RETURN
The argument is held by what the callable returns: handed back, not kept beyond the result.- See Also:
-
-
Constructor Details
-
CloseableArgumentKeeping
CloseableArgumentKeeping()
-
-
Method Details
-
declared
A callable that was walked: what it does with each of its parameters is then known. -
keepsOpen
-
aliases
The localtonow refers to the same object asfrom. -
forwardsOpen
The variable is passed on, whole, totarget's parameter: if that keeps it, so does this callable. -
passedToCall
The variable is passed, whole, to a method or function of the program's own. -
receiverPassed
The object a method runs on -Holder.of(method, null), its receiver - is passed on, as the receiver, to a method of the program's own: if that method keeps ITS receiver, so does this one. -
fateOf
What the constructor does with the argument given atindex. Only valid aftercheck(). -
keeps
The constructor stores its parameter atindexin a closeable property of the object it constructs. -
forwards
The constructor passes its own parameter atfromIndextotargetattoIndex: if the target keeps it, so does this constructor. -
notFresh
void notFresh(MethodSymbol target, int index, ErrorListener errorListener, IToken location, String argument) A construction is given a closeable value that is not new atindex: an error when the constructor keeps that parameter. -
check
void check()After every source has been walked: close the kept set over the forwards, derive what every callable keeps, then report every construction that hands a kept parameter a value that is not new. Writes squirrelled data (the derived RETAINS): run under the program lock.
-