Class CapturedVariableRepointedOrError
java.lang.Object
org.ek9lang.compiler.phase3.CapturedVariableRepointedOrError
- All Implemented Interfaces:
Consumer<EK9Parser.AssignmentStatementContext>
final class CapturedVariableRepointedOrError
extends Object
implements Consumer<EK9Parser.AssignmentStatementContext>
A dynamic function never re-points a variable it captured (E08280). A capture is either an initial value - the
function reads it - or a way back out - the function mutates the object it shares with the caller (
:=:,
:~:, :^:, +=, ...), so the caller sees the change. A plain assignment (:,
:=, =, :=?) does neither: it moves only the function's own name to another object, so the
caller's object is untouched (2026-11-14: rtn: lockedItem >= amount inside a MutexKey compiled clean
and the caller's rtn stayed false), and a new value wants a new variable.
Dynamic FUNCTIONS only: in a dynamic class a capture is a field, and assigning a field from a method is ordinary object state. A captured value escaping - added to a collection, stored, returned - is a design choice, not this.
-
Constructor Summary
ConstructorsConstructorDescriptionCapturedVariableRepointedOrError(SymbolsAndScopes symbolsAndScopes, ErrorListener errorListener) -
Method Summary
-
Constructor Details
-
CapturedVariableRepointedOrError
CapturedVariableRepointedOrError(SymbolsAndScopes symbolsAndScopes, ErrorListener errorListener)
-
-
Method Details
-
accept
- Specified by:
acceptin interfaceConsumer<EK9Parser.AssignmentStatementContext>
-