Class SelfReferenceStore

java.lang.Object
org.ek9lang.compiler.support.SelfReferenceStore

public final class SelfReferenceStore extends Object
THE reading of a statement that stores the object in one of its OWN properties - me: this, next := this, this.owner :=? this - a property of the object's own type that refers back to it.

Storing 'this' like that is not a use of the object: nothing is read through it and nothing outside the object holds it, so it completes that property for the 'used before fully constructed' check (E08061) like any other assignment (Steve, 2026-10-05, decision F). The property then IS 'this' under another name, so every other appearance of it in that constructor is a use of the object (propertiesStoredIn(EK9Parser.MethodDeclarationContext, SymbolsAndScopes)) - which is what keeps the self reference from becoming a way to read a half-built object.

Only a pointer assignment re-points the property (ReferenceAssignment.repointsTarget(EK9Parser.AssignmentStatementContext)); the right-hand side must be 'this' itself. Storing into ANOTHER object (other.parent: this) is E08250, unchanged; and as the property is 'this' in that constructor, passing it out (reg.register(me)) is E08250 as passing 'this' is (isSelfReference(ParseTree, ISymbol, SymbolsAndScopes), read by phase 3's escape check).

The PARENT LINK is the same store one step removed (Steve, 2026-10-08, F4): a statement giving one of the object's OWN properties a dynamic function or class whose capture list captures 'this' itself (child :=? (owner: this) with trait of Child as class ..., also with := or :) stores the object in the new child (capturedInto(EK9Parser.AssignmentStatementContext, SymbolsAndScopes)). Nothing is read through it while the statement runs, so E08061 lets it set that property while other properties are still unset - provided each of those is set by a LATER statement of the same kind (captureAssignmentsIn(EK9Parser.MethodDeclarationContext, SymbolsAndScopes)). The property then holds the object under another name, exactly as me: this does, so it is one of propertiesStoredIn(EK9Parser.MethodDeclarationContext, SymbolsAndScopes): in that constructor, using it before the object is complete is E08061, and passing it out is E08250.