Record Class ResolvedFunction

java.lang.Object
java.lang.Record
com.darkcollective.relix.semantic.internal.ResolvedFunction
Record Components:
symbols - every symbol the name resolves to, in the order the symbol table returned them; empty when the name is unknown
definition - the catalogue definition, when the catalogue is what defined this name; empty for a user-defined function or an unknown name

public record ResolvedFunction(List<FunctionSymbol> symbols, Optional<ScalarFunction> definition) extends Record
What a call site's function name resolved to — the symbols visible to the rest of the pipeline, and the catalogue definition behind them when there is one.

This is the one place the two directories of functions meet. A name is looked up in the symbol table first, so a def always wins over a library function of the same name; a name the table does not hold is looked up in the FunctionCatalog and, when found, registered into the table. That registration is the laziness the IR depends on: a symbol table lists the functions its script actually calls, not the whole installed library, so an IR dump stays the size of the script.

Arity is answered from the catalogue whenever the catalogue is what defined the name, because a signature's Arity is a range and a symbol's parameter list is not. Mid declares three parameters and accepts two or three arguments; asking the symbol would reject Mid(s, 2) the moment the first reference registered it. A user-defined function has no range, so its parameter count is the answer.

  • Constructor Details

    • ResolvedFunction

      public ResolvedFunction(List<FunctionSymbol> symbols, Optional<ScalarFunction> definition)
      Creates an instance of a ResolvedFunction record class.
      Parameters:
      symbols - the value for the symbols record component
      definition - the value for the definition record component
  • Method Details

    • toString

      public final 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.
    • symbols

      public List<FunctionSymbol> symbols()
      Returns the value of the symbols record component.
      Returns:
      the value of the symbols record component
    • definition

      public Optional<ScalarFunction> definition()
      Returns the value of the definition record component.
      Returns:
      the value of the definition record component