Class FunctionHeader

java.lang.Object
org.openzen.zenscript.codemodel.FunctionHeader

public class FunctionHeader extends Object
  • Field Details

    • typeParameters

      public final TypeParameter[] typeParameters
    • parameters

      public final FunctionParameter[] parameters
    • thrownType

      public final TypeID thrownType
    • minParameters

      public final int minParameters
    • maxParameters

      public final int maxParameters
    • hasUnknowns

      public final boolean hasUnknowns
  • Constructor Details

  • Method Details

    • isVariadic

      public boolean isVariadic()
    • isVariadicCall

      public boolean isVariadicCall(CallArguments arguments, TypeScope scope)
    • isVariadicCall

      public boolean isVariadicCall(CallArguments arguments)
    • useTypeParameters

      public boolean[] useTypeParameters()
    • getReturnType

      public TypeID getReturnType()
    • setReturnType

      public void setReturnType(TypeID returnType)
    • getParameterType

      public TypeID getParameterType(boolean isVariadic, int index)
    • getParameter

      public FunctionParameter getParameter(boolean isVariadic, int index)
    • isDenormalized

      public boolean isDenormalized()
    • normalize

      public FunctionHeader normalize(GlobalTypeRegistry registry)
    • getNumberOfTypeParameters

      public int getNumberOfTypeParameters()
    • hasAnyDefaultValues

      public boolean hasAnyDefaultValues()
    • inferFromOverride

      public FunctionHeader inferFromOverride(GlobalTypeRegistry registry, FunctionHeader overridden)
    • matchesExactly

      public boolean matchesExactly(CodePosition position, CallArguments arguments, TypeScope scope)
    • matchesImplicitly

      public boolean matchesImplicitly(CodePosition position, CallArguments arguments, TypeScope scope)
    • getCanonicalWithoutReturnType

      public String getCanonicalWithoutReturnType()
    • getCanonical

      public String getCanonical()
    • hasInferenceBlockingTypeParameters

      public boolean hasInferenceBlockingTypeParameters(TypeParameter[] parameters)
    • accepts

      public boolean accepts(TypeScope scope, Expression... arguments)
    • canOverride

      public boolean canOverride(TypeScope scope, FunctionHeader other)
    • isEquivalentTo

      public boolean isEquivalentTo(FunctionHeader other)
      Checks if two function headers are equivalent. Functions headers are equivalent if their types are the same.
      Parameters:
      other -
      Returns:
    • isSimilarTo

      public boolean isSimilarTo(FunctionHeader other)
      Checks if two function headers are similar. "similar" means that there exists a set of parameters for which there is no way to determine which one to call.

      Note that this does not mean that there is never confusion about which method to call. There can be confusion due to implicit conversions. This can be resolved by performing the conversions explicitly.

      It is illegal to have two similar methods with the same name.

      Parameters:
      other -
      Returns:
    • instanceForCall

      public FunctionHeader instanceForCall(CodePosition position, GlobalTypeRegistry registry, CallArguments arguments)
    • withGenericArguments

      public FunctionHeader withGenericArguments(GenericMapper mapper)
    • fillGenericArguments

      public FunctionHeader fillGenericArguments(CodePosition position, TypeScope scope, TypeID[] arguments)
    • forTypeParameterInference

      public FunctionHeader forTypeParameterInference()
    • forLambda

      public FunctionHeader forLambda(FunctionHeader lambdaHeader)
    • getVariadicParameter

      public FunctionParameter getVariadicParameter()
    • explainWhyIncompatible

      public String explainWhyIncompatible(TypeScope scope, CallArguments arguments)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • accepts

      public boolean accepts(int arguments)
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object