Class PropertyCycleMarker

java.lang.Object
org.ek9lang.compiler.phase5.PropertyCycleMarker

public final class PropertyCycleMarker extends Object
Marks the types whose objects can reach themselves through their properties, so phase 7 guards only THEIR generated operators against a cyclic object graph (Steve, 2026-10-05: the hybrid - a compile error on a potentially cyclic type would reject every legitimate tree, a runtime guard on every type would tax the hottest operator in the language).

Runs PropertyTypeGraph from the types that actually GET a generated recursive operator, through the shared Tarjan. A type whose FIELDS node is in a cyclic component is marked PROPERTY_CYCLE; each of its fields whose held node (PropertyTypeGraph.holdsOf(ISymbol)) is in the SAME component (so it can lead back) is marked CYCLIC_PROPERTY. Only a cycle can make an operator recurse forever, and recursion can only loop through cycle members, so guarding exactly these is enough - a type that merely REACHES a cycle is unchanged.

Every concrete parameterisation of a developer's generic is marked as analysed ("FALSE" unless cyclic): phase 7 still creates a few parameterisations, and PropertyCycles guards one it finds unanalysed.

Adds no errors. Call under the program lock: it writes squirrelled data.

  • Constructor Details

  • Method Details

    • mark

      public int mark()
      Find and mark the cyclic types.
      Returns:
      the number of types marked cyclic