- All Known Subinterfaces:
Type.Array,Type.Declared,Type.Delegated,Type.Function,Type.Primitive
public interface Type
Instances of this class are used to model types in the foreign language.
Instances of this class support the visitor pattern (see
accept(Type.Visitor, Object) and
Type.Visitor).-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceAn array type.static interfaceInstances of this class are used to model types which are associated to a declaration in the foreign language (seeDeclaration).static interfaceA delegated type is used to model a type which contains an indirection to some other underlying type.static interfaceA function type.static interfaceA primitive type.static interfaceType visitor interface. -
Method Summary
Modifier and TypeMethodDescription<R,D> R accept(Type.Visitor<R, D> visitor, D data) Entry point for visiting type instances.static Type.ArrayCreates a new array type with given element count and element type.static Type.ArrayCreates a new array type with given element type.static Type.Declareddeclared(Declaration.Scoped tree) Creates a new declared type with given foreign declaration.static Optional<FunctionDescriptor>descriptorFor(Type.Function function) Compute the function descriptor for a given function type.booleanCompares the specified object with this Type for equality.static Typeerror()Creates an erroneous type.static Type.FunctionCreates a new function type with given parameter types and return type.inthashCode()Returns the hash code value for this Type.booleanIs this type the erroneous type?static Optional<MemoryLayout>Compute the layout for a given type.static Type.Delegatedpointer()Creates a new pointer type with no associated pointee information.static Type.DelegatedCreates a new pointer type with given pointee type.static Type.DelegatedCreates a new pointer type with given pointee type.static Type.Primitiveprimitive(Type.Primitive.Kind kind) Creates a new primitive type given kind.static Type.Delegatedqualified(Type.Delegated.Kind kind, Type type) Creates a new qualified type given kind and underlying type.static Type.DelegatedCreates a new typedef type given name and underlying type.static Type.ArrayCreates a new vector type with given element count and element type.static Type.Primitivevoid_()Create thevoidtype.
-
Method Details
-
isErroneous
boolean isErroneous()Is this type the erroneous type?- Returns:
- true, if this type is the erroneous type.
-
accept
Entry point for visiting type instances.- Type Parameters:
R- the visitor's return type.D- the visitor's argument type.- Parameters:
visitor- the type visitor.data- optional data to be passed to the visitor.- Returns:
- the result of visiting this type through the specified type visitor.
-
equals
Compares the specified object with this Type for equality. Returnstrueif and only if the specified object is also a Type and both the Types are equal. -
hashCode
int hashCode()Returns the hash code value for this Type. -
layoutFor
Compute the layout for a given type.- Parameters:
t- the type.- Returns:
- the layout for given type.
-
descriptorFor
Compute the function descriptor for a given function type.- Parameters:
function- the function type.- Returns:
- the function descriptor for given function type.
-
void_
Create thevoidtype.- Returns:
- the
voidtype.
-
primitive
Creates a new primitive type given kind.- Parameters:
kind- the primitive type kind.- Returns:
- a new primitive type with given kind.
-
qualified
Creates a new qualified type given kind and underlying type.- Parameters:
kind- the qualified type kind.type- the qualified type underlying type.- Returns:
- a new qualified type with given name and underlying type.
-
typedef
Creates a new typedef type given name and underlying type.- Parameters:
name- the typedef type name.aliased- the typeef type underlying type.- Returns:
- a new typedef type with given name and underlying type.
-
pointer
Creates a new pointer type with no associated pointee information.- Returns:
- a new pointer type with no associated pointee information.
-
pointer
Creates a new pointer type with given pointee type.- Parameters:
pointee- the pointee type.- Returns:
- a new pointer type with given pointee type.
-
pointer
Creates a new pointer type with given pointee type.- Parameters:
pointee- factory to (lazily) build the pointee type.- Returns:
- a new pointer type with given pointee type (lazily built from factory).
-
function
Creates a new function type with given parameter types and return type.- Parameters:
varargs- is this function type variable-arity?returnType- the function type return type.arguments- the function type formal parameter types.- Returns:
- a new function type with given parameter types and return type.
-
declared
Creates a new declared type with given foreign declaration.- Parameters:
tree- the foreign declaration the type refers to.- Returns:
- a new declared type with given foreign declaration.
-
vector
Creates a new vector type with given element count and element type.- Parameters:
elementCount- the vector type element count.elementType- the vector type element type.- Returns:
- a new vector type with given element count and element type.
-
array
Creates a new array type with given element count and element type.- Parameters:
elementCount- the array type element count.elementType- the array type element type.- Returns:
- a new array type with given element count and element type.
-
array
Creates a new array type with given element type.- Parameters:
elementType- the array type element type.- Returns:
- a new array type with given element type.
-
error
Creates an erroneous type.- Returns:
- an erroneous type.
-