Class CapturedCloseableOwnershipOrError
java.lang.Object
org.ek9lang.compiler.phase5.CapturedCloseableOwnershipOrError
Capture ownership by FRESHNESS (R-E, Steve 2026-10-06) - never by the named/unnamed syntax of the capture.
- A dynamic CLASS that captures a NEW closeable (
(res: Res("x"))) takes it over: the capture is markedOWNED_CAPTURE, soCloseStepscounts it as a field the class holds - the class must declare its own close (E81067) and its generated close closes it. - A dynamic FUNCTION has no close, so a NEW closeable it captured could never be closed: E81069.
- Anything that is not new - a named variable,
(owner: this), a property - is a BORROW: its owner is the scope that made the dynamic construct, so it is neither marked nor an error (critic c11, the dynamic-class view ofthis, keeps compiling and is closed once, by its real owner).
"New" is THE fresh predicate, IsFreshValueExpression.forCloseableReturns(Function) - the same one the fresh-store
rule (E81062) uses for every other closeable slot. Marked here, in Walk 1 on entering the construct, so the
holder rule on exit, the call graph (Walk 2) and IR generation all read the same mark.
-
Constructor Summary
ConstructorsConstructorDescriptionCapturedCloseableOwnershipOrError(SymbolsAndScopes symbolsAndScopes, ErrorListener errorListener) -
Method Summary
Modifier and TypeMethodDescription(package private) voidA dynamic class: mark each fresh closeable capture as owned.(package private) voidA dynamic function: a fresh closeable capture is E81069.
-
Constructor Details
-
CapturedCloseableOwnershipOrError
CapturedCloseableOwnershipOrError(SymbolsAndScopes symbolsAndScopes, ErrorListener errorListener)
-
-
Method Details
-
accept
A dynamic class: mark each fresh closeable capture as owned. -
accept
A dynamic function: a fresh closeable capture is E81069.
-