Class FieldSetStatusSymbolGenerator

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

public final class FieldSetStatusSymbolGenerator extends Object
Creates the synthetic _fieldSetStatus method symbol used as an IR carrier.

_fieldSetStatus is infrastructure behind several default operators (?, $, $$, #?, ==, <=>). It is not an EK9 method name: no programmer writes it and it cannot be called from EK9 source. It belongs to the same layer as _lt and _eq - how an operator is emitted - not to the symbol table, which holds what the programmer wrote (F37).

The symbol is DETACHED and must stay that way. It is returned to the caller and never define()d into the aggregate's scope. Defining it there cost, in order: 448 mutations of the shared model after the point at which the model is supposed to be complete; an entire single-threaded lock-held pre-pass in IRGenerator invented to stop those mutations racing the parallel IR generation that reads aggregate scopes; and a documented incompleteness in that pre-pass, which covered only module-scope aggregates. All three were consequences of putting a backend name in the symbol table, and all three go away by not doing that.

The method body IR is produced separately by FieldSetStatusGenerator; this only makes the carrier the operations loop needs.

  • Field Details

    • FIELD_SET_STATUS_GENUSES

      public static final Set<SymbolGenus> FIELD_SET_STATUS_GENUSES
      Construct genuses whose IR generators emit _fieldSetStatus.

      THE definition of which aggregates have one. It lives here rather than in IRGenerator because whether a type has this method is now derived from its genus rather than discovered by resolving a symbol - which is what lets a generator decide for a type in another source without reading, or writing, that type's scope.

  • Method Details

    • createFor

      public static Optional<MethodSymbol> createFor(AggregateSymbol aggregateSymbol, ISymbol bitsType)
      Create the detached _fieldSetStatus carrier for this aggregate, if it should have one.
      Parameters:
      aggregateSymbol - the aggregate being generated.
      bitsType - the resolved org.ek9.lang::Bits type (the method's return type).
      Returns:
      the carrier, or empty for a still-generic template or an aggregate that already declares the method in source.