Class CloseSteps
java.lang.Object
org.ek9lang.compiler.support.CloseSteps
THE decision of what a type's
operator close is responsible for - use it, never re-derive it. "If you
hold it, you close it" (Steve, 2026-10-06, D8): every check and every generator that asks "which of this type's
fields must its close close?", "which parent close does it chain to?" or "does this type declare its own close?"
asks HERE, so the holder-must-close rule (E81067), the vacuous-default rule (E81070), the phase-5 call graph and
the generated close chain in phase 7 cannot disagree.
isCloseOperator(MethodSymbol)- the method is a type's close operator.of(MethodSymbol)- THE chain:CloseSteps.Steps.closed()(what its close closes, in ACQUISITION order - the generated code closes them last first) andCloseSteps.Steps.parentClose()(the one parent close it then calls, non-virtually).closedProperties(IAggregateSymbol)- the fields its close closes, in acquisition order: first the captures a dynamic class OWNS (a fresh captured expression is a transfer, R-E - markedOWNED_CAPTUREin PRE_IR_CHECKS; captures are constructor arguments, set before any initialiser runs), then its OWNgetProperties()in declaration order, keeping those whose type is a managed closeable (CloseableResourceToBeChecked.isManagedCloseableType(ISymbol), so never a bareTand never a standard stream), minus the exclusions (R-G), stated once here:- an injected property (
store as Store!) - the application's registry owns it; - the delegate of a
by-delegation proxy close - the proxy forwards close to it, so it is closed already (a class that writes its own close gets no proxy and owns the delegate like any property); - a capture that is not fresh (named,
(owner: this)) - a borrow: its owner is the scope that made the dynamic class.
- an injected property (
parentClose(IAggregateSymbol)- the super CLASS's close, when it has a non-abstract one (its own or one it inherits from a class). A trait's close is never chained (D8: a trait's close is abstract, E81066), so neither isCloseable's.declaredClose(IAggregateSymbol)- the close this type DECLARES ITSELF: in its own scope, not abstract and not a delegation proxy. An inherited close never counts - it cannot see a field the sub-type adds (critic c15).isDefaultedClose(MethodSymbol)- the type asked fordefault operator close.
Inherited properties are the super's to close, through the super's own close - which is why the chain ends in
CloseSteps.Steps.parentClose(). A body the developer writes runs FIRST, with everything still open; the chain then
runs on every path (it is the body's finally). Nothing is generated when CloseSteps.Steps.isEmpty().
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordWhat a type's close closes, and the parent close it then calls. -
Method Summary
Modifier and TypeMethodDescriptionstatic List<MethodSymbol> chainedCloses(IAggregateSymbol aggregate) Every type a close of this type reaches through its chain - the static types of the closed fields and the owner of the parent close - for the call graph (each is called by the generated close).closedProperties(IAggregateSymbol aggregate) The fields the type's close closes, in acquisition order: owned captures, then own closeable properties.static Optional<MethodSymbol> declaredClose(IAggregateSymbol aggregate) The close operator this type declares itself, if any: own scope, not abstract, not a delegation proxy.static booleanisCloseOperator(MethodSymbol method) True when the method is a type's close operator.static booleanisDefaultedClose(MethodSymbol method) True when the operator is a close the developer asked for withdefault operator close.static booleanisOwnedCapture(ISymbol capture) True when the capture was marked as owned by the dynamic class that made it.static CloseSteps.Stepsof(IAggregateSymbol aggregate) THE generated chain of a type's close.static CloseSteps.Stepsof(MethodSymbol closeOperator) THE generated chain of the type a close operator belongs to.ownedCaptures(IAggregateSymbol aggregate) The captures a dynamic class owns: each one PRE_IR_CHECKS marked as a fresh closeable (R-E).static Optional<MethodSymbol> parentClose(IAggregateSymbol aggregate) The close of the nearest super CLASS that has one, when it is not abstract.
-
Method Details
-
isCloseOperator
True when the method is a type's close operator. -
of
THE generated chain of the type a close operator belongs to. -
of
THE generated chain of a type's close. -
closedProperties
The fields the type's close closes, in acquisition order: owned captures, then own closeable properties. -
ownedCaptures
The captures a dynamic class owns: each one PRE_IR_CHECKS marked as a fresh closeable (R-E). -
isOwnedCapture
True when the capture was marked as owned by the dynamic class that made it. -
parentClose
The close of the nearest super CLASS that has one, when it is not abstract. Traits are never consulted. -
declaredClose
The close operator this type declares itself, if any: own scope, not abstract, not a delegation proxy. -
isDefaultedClose
True when the operator is a close the developer asked for withdefault operator close. -
chainedCloses
Every type a close of this type reaches through its chain - the static types of the closed fields and the owner of the parent close - for the call graph (each is called by the generated close).
-