Class ConstructionEdges

java.lang.Object
org.ek9lang.compiler.phase5.construction.ConstructionEdges

public final class ConstructionEdges extends Object
The calls that ALWAYS run when a callable runs, collected for FE77's construction-recursion check (E08263) by the phase-5 call-graph collector, in the same walk that builds the call graph.

Only what always runs is kept (MustExecutePosition), and only calls that are statically dispatched, so a cycle found over these edges is certain: once any member runs, none can finish. Callers are keyed exactly as in the call graph (CallableIdentity), so a generic's members are keyed once, by its template, and the check applies each parameterisation afterwards.

Thread-safe for the parallel per-source collection; read single-threaded afterwards.

  • Method Details

    • collecting

      public static ConstructionEdges collecting()
      A store that collects.
    • discarding

      public static ConstructionEdges discarding()
      A store that ignores everything - for call-graph builds that do not run the check.
    • isCollecting

      public boolean isCollecting()
      True if this store keeps what it is given, so a caller can skip the work of deciding what to give it.
    • addMustCall

      public void addMustCall(String callerKey, ConstructionEdges.Target target, IToken token, boolean explicitCall)
      Record an always-run call made by the callable with this call-graph identity.
    • addConstructionNode

      public void addConstructionNode(String key, ISymbol symbol)
      Record a construction node - a constructor, or a type's _i_init - which every cycle reported must contain.
      Parameters:
      key - its call-graph identity
      symbol - the constructor, or the aggregate for _i_init
    • mustCallsFrom

      public Collection<ConstructionEdges.MustCall> mustCallsFrom(String callerKey)
      The always-run calls a callable makes. Read only once collection has finished.
    • constructionNodes

      public Map<String,ISymbol> constructionNodes()
      Every construction node, by call-graph identity. Read only once collection has finished.