Record Class TextVariantTable

java.lang.Object
java.lang.Record
org.ek9lang.compiler.ir.data.TextVariantTable
Record Components:
baseFqn - the fully qualified name of the abstract base text
variants - one per language, sorted by language

public record TextVariantTable(String baseFqn, List<TextVariantTable.Variant> variants) extends Record
The locale variants of a text, carried on the IR construct of the text's abstract base: THE list a back end lowers the base's _textFactory(language) dispatch from - JVM and LLVM alike.

A text's locales may be declared in several source files of one module. The IR is where that is resolved, once: IR generation collects every variant across the module and records them here, sorted by language so every build dispatches in the same order. A back end must read this table and never re-derive the list from a symbol scope - doing that from the scope of one file was front-end audit FE31, where locales declared in any other file were silently unset at runtime.

This is also why the base's generated code depends on its sibling files: an incremental build must treat a change to any file declaring a locale of the text as a change to the base (docs/implementation/ EK9_INCREMENTAL_BUILD_POSITION.md section 4).

  • Constructor Details

    • TextVariantTable

      public TextVariantTable(String baseFqn, List<TextVariantTable.Variant> variants)
      Validated, and the variants held in language order whatever order they were found in.
  • Method Details

    • toString

      @Nonnull public String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • baseFqn

      public String baseFqn()
      Returns the value of the baseFqn record component.
      Returns:
      the value of the baseFqn record component
    • variants

      public List<TextVariantTable.Variant> variants()
      Returns the value of the variants record component.
      Returns:
      the value of the variants record component