Package org.openzen.zenscript.codemodel
Class FunctionHeader
java.lang.Object
org.openzen.zenscript.codemodel.FunctionHeader
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal booleanfinal intfinal intfinal FunctionParameter[]final TypeIDfinal TypeParameter[] -
Constructor Summary
ConstructorsConstructorDescriptionFunctionHeader(TypeParameter[] typeParameters, TypeID returnType, TypeID thrownType, FunctionParameter... parameters) FunctionHeader(TypeID returnType) FunctionHeader(TypeID returnType, FunctionParameter... parameters) FunctionHeader(TypeID returnType, TypeID... parameterTypes) -
Method Summary
Modifier and TypeMethodDescriptionbooleanaccepts(int arguments) booleanaccepts(TypeScope scope, Expression... arguments) booleancanOverride(TypeScope scope, FunctionHeader other) booleanexplainWhyIncompatible(TypeScope scope, CallArguments arguments) fillGenericArguments(CodePosition position, TypeScope scope, TypeID[] arguments) forLambda(FunctionHeader lambdaHeader) intgetParameter(boolean isVariadic, int index) getParameterType(boolean isVariadic, int index) booleaninthashCode()booleanhasInferenceBlockingTypeParameters(TypeParameter[] parameters) inferFromOverride(GlobalTypeRegistry registry, FunctionHeader overridden) instanceForCall(CodePosition position, GlobalTypeRegistry registry, CallArguments arguments) booleanbooleanisEquivalentTo(FunctionHeader other) Checks if two function headers are equivalent.booleanisSimilarTo(FunctionHeader other) Checks if two function headers are similar.booleanbooleanisVariadicCall(CallArguments arguments) booleanisVariadicCall(CallArguments arguments, TypeScope scope) booleanmatchesExactly(CodePosition position, CallArguments arguments, TypeScope scope) booleanmatchesImplicitly(CodePosition position, CallArguments arguments, TypeScope scope) normalize(GlobalTypeRegistry registry) voidsetReturnType(TypeID returnType) toString()boolean[]withGenericArguments(GenericMapper mapper)
-
Field Details
-
typeParameters
-
parameters
-
thrownType
-
minParameters
public final int minParameters -
maxParameters
public final int maxParameters -
hasUnknowns
public final boolean hasUnknowns
-
-
Constructor Details
-
FunctionHeader
-
FunctionHeader
-
FunctionHeader
-
FunctionHeader
public FunctionHeader(TypeParameter[] typeParameters, TypeID returnType, TypeID thrownType, FunctionParameter... parameters)
-
-
Method Details
-
isVariadic
public boolean isVariadic() -
isVariadicCall
-
isVariadicCall
-
useTypeParameters
public boolean[] useTypeParameters() -
getReturnType
-
setReturnType
-
getParameterType
-
getParameter
-
isDenormalized
public boolean isDenormalized() -
normalize
-
getNumberOfTypeParameters
public int getNumberOfTypeParameters() -
hasAnyDefaultValues
public boolean hasAnyDefaultValues() -
inferFromOverride
-
getCanonicalWithoutReturnType
-
getCanonical
-
hasInferenceBlockingTypeParameters
-
accepts
-
canOverride
-
isEquivalentTo
Checks if two function headers are equivalent. Functions headers are equivalent if their types are the same.- Parameters:
other-- Returns:
-
isSimilarTo
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:
-
withGenericArguments
-
forTypeParameterInference
-
forLambda
-
getVariadicParameter
-
explainWhyIncompatible
-
toString
-
accepts
public boolean accepts(int arguments) -
equals
-
hashCode
public int hashCode()
-