Class CloseOperatorCallOrError
Closing is generated (D4): a try-with-resources resource is closed when its try ends, a closeable value a statement
makes but never names is closed when that statement finishes, and a type's own closeable properties are closed by
its operator close - default operator close or one the developer writes for extra work - which
ends with the generated chain (CloseSteps). There is no close statement any more (the grammar keeps
close x only to report E01094). Calling the operator as a METHOD - res.close(),
this.close(), a bare close() inside the type, make().close() - would close a value its
owner still closes, so a try resource could be closed inside its try and again by the try, a capture closed under
the scope that owns it, a property closed and then used. Any call that resolves to a close operator, on any
receiver, is therefore an error. The compiler's own closes are generated in IR and never pass through here.
super.close() is no exception (Steve, 2026-10-06): the generated chain closes the type's own closeable
properties and then calls the super CLASS's close non-virtually, so a hand-written super.close() would
close the super's resources twice.
-
Field Summary
Fields inherited from class RuleSupport
errorListener, symbolsAndScopes -
Constructor Summary
ConstructorsConstructorDescriptionCloseOperatorCallOrError(SymbolsAndScopes symbolsAndScopes, ErrorListener errorListener) -
Method Summary
-
Constructor Details
-
CloseOperatorCallOrError
CloseOperatorCallOrError(SymbolsAndScopes symbolsAndScopes, ErrorListener errorListener)
-
-
Method Details
-
accept
-