Record Class EfunSignature

java.lang.Object
java.lang.Record
io.github.protasm.jvmud.compiler.efun.EfunSignature
Record Components:
symbol - function symbol containing the LPC-facing name and return type
parameterTypes - fixed LPC parameter types for this overload
varargsParameterType - LPC type accepted by additional tail arguments, or null

public record EfunSignature(Symbol symbol, List<LPCType> parameterTypes, LPCType varargsParameterType) extends Record
Describes the LPC-facing signature of an engine function.

The Symbol stores the function name and return type. The parameter list stores the fixed LPC parameter types accepted by one overload. Signatures may also declare an optional varargs tail type for engine functions that accept any number of additional arguments.

  • Constructor Details

    • EfunSignature

      public EfunSignature(Symbol symbol, List<LPCType> parameterTypes)
    • EfunSignature

      public EfunSignature(Symbol symbol, List<LPCType> parameterTypes, LPCType varargsParameterType)
      Creates an immutable signature.

      A null parameter list is normalized to an empty list so zero-argument efuns can be declared tersely by simple callers. A null varargs parameter type means the signature accepts only its fixed parameters.

  • Method Details

    • name

      public String name()
      Returns the LPC-facing function name.
      Returns:
      function name used in LPC calls and registry lookup
    • returnType

      public LPCType returnType()
      Returns the LPC return type.
      Returns:
      return type advertised to semantic analysis and generated bytecode
    • arity

      public int arity()
      Returns the fixed number of LPC arguments before any optional varargs tail.
      Returns:
      parameter count
    • isVarargs

      public boolean isVarargs()
      Returns whether this signature accepts optional tail arguments.
    • acceptsArity

      public boolean acceptsArity(int arity)
      Returns whether this signature accepts a call with arity arguments.
    • isExactArity

      public boolean isExactArity(int arity)
      Returns whether this signature is an exact fixed-arity match for arity.
    • 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.
    • symbol

      public Symbol symbol()
      Returns the value of the symbol record component.
      Returns:
      the value of the symbol record component
    • parameterTypes

      public List<LPCType> parameterTypes()
      Returns the value of the parameterTypes record component.
      Returns:
      the value of the parameterTypes record component
    • varargsParameterType

      public LPCType varargsParameterType()
      Returns the value of the varargsParameterType record component.
      Returns:
      the value of the varargsParameterType record component