FunctionTypeSpec¶
-
public final class
FunctionTypeSpec
extends TypeSpec¶ A type for functions and procedures, for instance (arg1T, arg2T…)→returnT.
Fields¶
argumentsTypes¶
-
public WrapperTypeSpec[]
argumentsTypes
¶ The array of arguments types of this function type.
returnType¶
-
public WrapperTypeSpec
returnType
¶ The return type of this function type.
Constructors¶
FunctionTypeSpec¶
-
public
FunctionTypeSpec
(WrapperTypeSpec returnType)¶ Create a new function type, with the given return type.
FunctionTypeSpec¶
-
public
FunctionTypeSpec
(WrapperTypeSpec returnType, WrapperTypeSpec[] argumentsTypes)¶ Create a new function type, with the given arguments types and return type.
FunctionTypeSpec¶
-
public
FunctionTypeSpec
(WrapperTypeSpec returnType, WrapperTypeSpec[] argumentsTypes, boolean varArgList)¶ Create a new function type of variable arguments length, with the given arguments types and return type.
FunctionTypeSpec¶
-
public
FunctionTypeSpec
(WrapperTypeSpec returnType, TapList<WrapperTypeSpec> paramsTypes)¶ Create a new function type, with the given arguments types and return type.
Methods¶
baseTypeSpec¶
-
public WrapperTypeSpec
baseTypeSpec
(boolean stopOnPointer)¶
complexAbsAmbiguous¶
-
public static boolean
complexAbsAmbiguous
(String unitName, TypeSpec[] formalArgsTypes, TypeSpec[] actualArgsTypes)¶ Returns true when this unitName, called with actualArgsTypes that possibly match its formalArgsTypes, and therefore that seems to match the call site, actually does NOT match because it is an “abs” (absolute value) actually called on floats whereas this Unit is about “abs” called on complex. The fact that we need this test may be seen as a weakness or a bug in the actual type-checking process
differentiateTypeSpec¶
-
public WrapperTypeSpec
differentiateTypeSpec
(SymbolTable symbolTable, SymbolTable srcSymbolTable, int diffUnitSort, String fSuffix, boolean localDecl, boolean multiDirMode, ArrayDim multiDirDimensionMax, String hintArrayNameInText, String hintArrayNameInIdent, Tree hintArrayNameTree, Tree nameTree)¶
doUpdateAfterImports¶
-
public void
doUpdateAfterImports
(SymbolTable symbolTable, TapList<TypeSpec> dejaVu)¶
finishLastMetaTypes¶
-
protected static void
finishLastMetaTypes
(TapList<TapTriplet<TypeSpec, TypeSpec, Boolean>> toAlreadySolved, SymbolTable symbolTable)¶ Replace remaining unsolved meta types with primitive types deduced from the name of the meta type e.g. “float…” → PrimitiveTypeSpec(“float”).
generateTree¶
-
public Tree
generateTree
(SymbolTable symbolTable, TapList<SymbolDecl> dependsOn, TapList<SymbolDecl> shortNames, boolean useShortNames, TapList<TypeSpec> dejaVu)¶
localize¶
matchArgumentsTypes¶
-
protected void
matchArgumentsTypes
(WrapperTypeSpec[] actualArgsTypes, Unit ctxtUnit, Unit calledUnit)¶ Instantiate this formal type of a function with the actual types “actualArgsTypes” of a particular call. This function formal type must be localized i.e. it is a copy that will not influence by unification the true, central, formal type of the function.
matchesCall¶
-
public boolean
matchesCall
(TypeSpec callResultType, TypeSpec[] callArgTypes)¶ Tests that this function type can be called with the given actual types, i.e. the arguments number matches and each arg formal type is larger than (i.e. is more general than, or “contains”, or could receive) the actual arg type.
- Parameters
callResultType – The expected result type at call site. May be null. (not used at present)
callArgTypes – The array of the actual arguments types at call site. May be null if unknown.
- Returns
true if this function type matches the actual call, or may be made to match it by instantiating its “meta” types..
matchesCallExactly¶
sameTypes¶
-
public boolean
sameTypes
(WrapperTypeSpec otherReturnType, WrapperTypeSpec[] otherArgumentsTypes)¶
setReturnTypeSpec¶
-
public void
setReturnTypeSpec
(WrapperTypeSpec typeSpec, Tree declaratorI)¶