Class SelfReferenceStore
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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordA statement that gives one of the object's own properties a dynamic function or class capturing 'this'. -
Method Summary
Modifier and TypeMethodDescriptioncaptureAssignmentOf(EK9Parser.PrimaryReferenceContext ctx, SymbolsAndScopes symbolsAndScopes) The capture-assignment statement (capturedInto(EK9Parser.AssignmentStatementContext, SymbolsAndScopes)) in which this 'this' is captured: it is the whole expression of one entry of the capture list of the dynamic function or class that is the statement's whole right-hand side.captureAssignmentsIn(EK9Parser.MethodDeclarationContext constructor, SymbolsAndScopes symbolsAndScopes) The capture-assignment statements (capturedInto(EK9Parser.AssignmentStatementContext, SymbolsAndScopes)) a constructor body makes, in source order, each with the property it sets - not counting code that runs later (a dynamic function's body, a dynamic class's methods).capturedInto(EK9Parser.AssignmentStatementContext ctx, SymbolsAndScopes symbolsAndScopes) The property of this object that the assignment statement gives a dynamic function or class capturing 'this' itself (child :=? (owner: this) with trait of Child as class ...), if it does.static List<EK9Parser.ExpressionParamContext> capturesOfThis(EK9Parser.AssignmentExpressionContext assignment) The entries of the capture list whose expression is 'this' itself, when this right-hand side IS a dynamic function or class; empty for anything else.enclosingConstructor(org.antlr.v4.runtime.tree.ParseTree node, SymbolsAndScopes symbolsAndScopes) The constructor declaration this node is directly in, or null when it is in some other method, a function, or code that runs later (a dynamic function's body, a dynamic class's method).static booleanisAssignmentTarget(org.antlr.v4.runtime.tree.ParseTree node) True when the node is the identifier of a property ASSIGNED by the statement it is the target of (me: ...orthis.me: ...) - writing the property, not reading it.static booleanisSelfReference(org.antlr.v4.runtime.tree.ParseTree node, ISymbol symbol, SymbolsAndScopes symbolsAndScopes) True when the symbol is a property that the constructor this node is in stores 'this' into - so, in that constructor, the property is 'this' under another name.propertiesStoredIn(EK9Parser.MethodDeclarationContext constructor, SymbolsAndScopes symbolsAndScopes) The properties a constructor body stores 'this' into - directly (me: this) or in a dynamic function or class it gives them (child :=? (owner: this) ...) - not counting code that runs later (a dynamic function's body, a dynamic class's methods), where 'this' is a different object or the construction is over.storedProperty(EK9Parser.AssignmentStatementContext ctx, SymbolsAndScopes symbolsAndScopes) The property of this object that the assignment statement re-points at 'this', if it does.
-
Method Details
-
storedProperty
public static Optional<ISymbol> storedProperty(EK9Parser.AssignmentStatementContext ctx, SymbolsAndScopes symbolsAndScopes) The property of this object that the assignment statement re-points at 'this', if it does. -
capturedInto
public static Optional<ISymbol> capturedInto(EK9Parser.AssignmentStatementContext ctx, SymbolsAndScopes symbolsAndScopes) The property of this object that the assignment statement gives a dynamic function or class capturing 'this' itself (child :=? (owner: this) with trait of Child as class ...), if it does. -
captureAssignmentOf
public static Optional<EK9Parser.AssignmentStatementContext> captureAssignmentOf(EK9Parser.PrimaryReferenceContext ctx, SymbolsAndScopes symbolsAndScopes) The capture-assignment statement (capturedInto(EK9Parser.AssignmentStatementContext, SymbolsAndScopes)) in which this 'this' is captured: it is the whole expression of one entry of the capture list of the dynamic function or class that is the statement's whole right-hand side. -
capturesOfThis
public static List<EK9Parser.ExpressionParamContext> capturesOfThis(EK9Parser.AssignmentExpressionContext assignment) The entries of the capture list whose expression is 'this' itself, when this right-hand side IS a dynamic function or class; empty for anything else. -
captureAssignmentsIn
public static List<SelfReferenceStore.CaptureAssignment> captureAssignmentsIn(EK9Parser.MethodDeclarationContext constructor, SymbolsAndScopes symbolsAndScopes) The capture-assignment statements (capturedInto(EK9Parser.AssignmentStatementContext, SymbolsAndScopes)) a constructor body makes, in source order, each with the property it sets - not counting code that runs later (a dynamic function's body, a dynamic class's methods). -
isAssignmentTarget
public static boolean isAssignmentTarget(org.antlr.v4.runtime.tree.ParseTree node) True when the node is the identifier of a property ASSIGNED by the statement it is the target of (me: ...orthis.me: ...) - writing the property, not reading it. -
isSelfReference
public static boolean isSelfReference(org.antlr.v4.runtime.tree.ParseTree node, ISymbol symbol, SymbolsAndScopes symbolsAndScopes) True when the symbol is a property that the constructor this node is in stores 'this' into - so, in that constructor, the property is 'this' under another name. -
enclosingConstructor
public static EK9Parser.MethodDeclarationContext enclosingConstructor(org.antlr.v4.runtime.tree.ParseTree node, SymbolsAndScopes symbolsAndScopes) The constructor declaration this node is directly in, or null when it is in some other method, a function, or code that runs later (a dynamic function's body, a dynamic class's method). -
propertiesStoredIn
public static Set<ISymbol> propertiesStoredIn(EK9Parser.MethodDeclarationContext constructor, SymbolsAndScopes symbolsAndScopes) The properties a constructor body stores 'this' into - directly (me: this) or in a dynamic function or class it gives them (child :=? (owner: this) ...) - not counting code that runs later (a dynamic function's body, a dynamic class's methods), where 'this' is a different object or the construction is over.
-