Package org.ek9lang.compiler.support.selfreference


package org.ek9lang.compiler.support.selfreference
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 (StoredProperty).

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) - 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 (RepointsTarget); 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, 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). 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). The property then holds the object under another name, exactly as me: this does, so it is one of PropertiesStoredIn: in that constructor, using it before the object is complete is E08061, and passing it out is E08250.

  • Class
    Description
    Every assignment statement under a node, in source order - not counting code that runs later (a dynamic function's body, a dynamic class's methods).
    A statement that gives one of the object's own properties a dynamic function or class capturing 'this'.
    The capture-assignment statement (CapturedInto) 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.
    The capture-assignment statements (CapturedInto) 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).
    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 - the parent link.
    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.
    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).
    True when the node is the identifier of a property ASSIGNED by the statement it is the target of (me: ... or this.me: ...) - writing the property, not reading it.
    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.
    The expression is this itself.
    The property of this object an assignment statement assigns (me: ... or this.me: ...), if any.
    The properties a constructor body stores 'this' into - directly (me: this, StoredProperty) or in a dynamic function or class it gives them (child :=? (owner: this) ..., CapturedInto) - 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.
    The property of this object that the assignment statement re-points at 'this', if it does.