Class FieldSetStatusSymbolGenerator

java.lang.Object
org.ek9lang.compiler.phase7.synthesis.FieldSetStatusSymbolGenerator

public final class FieldSetStatusSymbolGenerator extends Object
Creates the synthetic _fieldSetStatus method SYMBOL on an aggregate, if not already present.

_fieldSetStatus is infrastructure used by many default operators (?, $, $$, #?, ==, <=>). It is added to every concrete aggregate (records, classes, components, services and monomorphized generics); it is not callable by EK9 developers. This factory only creates the method SYMBOL - the method body IR is produced separately by FieldSetStatusGenerator.

Extracted so the single-threaded pre-pass in IRGenerator and the per-construct generators (regular aggregates, services, parameterized wrappers) share ONE definition. Adding this symbol mutates the aggregate's scope, so for top-level (cross-source referenceable) aggregates it MUST be done before the multi-threaded IR generation reads aggregate scopes in parallel - otherwise a reader thread iterating an aggregate's scope races the mutation, surfacing as a ConcurrentModificationException. This honours the documented "symbols are read-only after phase 6" contract.

  • Method Details

    • ensurePresent

      public static void ensurePresent(AggregateSymbol aggregateSymbol, ISymbol bitsType)
      Ensure the _fieldSetStatus method symbol exists on the given aggregate. Idempotent: a no-op if the aggregate already declares it, or if it is a (still-generic) template type.
      Parameters:
      aggregateSymbol - the aggregate to augment.
      bitsType - the resolved org.ek9.lang::Bits type (the method's return type).