Type

extern (C++) abstract
class Type : ASTNode {
TY ty;
MOD mod;
char* deco;
Type pto;
Type rto;
Type arrayof;
TypeInfoDeclaration vtinfo;
type* ctype;
extern (C++) __gshared
Type tvoid;
extern (C++) __gshared
Type tint8;
extern (C++) __gshared
Type tuns8;
extern (C++) __gshared
Type tint16;
extern (C++) __gshared
Type tuns16;
extern (C++) __gshared
Type tint32;
extern (C++) __gshared
Type tuns32;
extern (C++) __gshared
Type tint64;
extern (C++) __gshared
Type tuns64;
extern (C++) __gshared
Type tint128;
extern (C++) __gshared
Type tuns128;
extern (C++) __gshared
Type tfloat32;
extern (C++) __gshared
Type tfloat64;
extern (C++) __gshared
Type tfloat80;
extern (C++) __gshared
Type timaginary32;
extern (C++) __gshared
Type timaginary64;
extern (C++) __gshared
Type timaginary80;
extern (C++) __gshared
Type tcomplex32;
extern (C++) __gshared
Type tcomplex64;
extern (C++) __gshared
Type tcomplex80;
extern (C++) __gshared
Type tbool;
extern (C++) __gshared
Type tchar;
extern (C++) __gshared
Type twchar;
extern (C++) __gshared
Type tdchar;
extern (C++) __gshared
Type tshiftcnt;
extern (C++) __gshared
Type tvoidptr;
extern (C++) __gshared
Type tstring;
extern (C++) __gshared
Type twstring;
extern (C++) __gshared
Type tdstring;
extern (C++) __gshared
Type terror;
extern (C++) __gshared
Type tnull;
extern (C++) __gshared
Type tnoreturn;
extern (C++) __gshared
Type tsize_t;
extern (C++) __gshared
Type tptrdiff_t;
extern (C++) __gshared
Type thash_t;
extern (C++) __gshared
ClassDeclaration dtypeinfo;
extern (C++) __gshared
ClassDeclaration typeinfoclass;
extern (C++) __gshared
ClassDeclaration typeinfointerface;
extern (C++) __gshared
ClassDeclaration typeinfostruct;
extern (C++) __gshared
ClassDeclaration typeinfopointer;
extern (C++) __gshared
ClassDeclaration typeinfoarray;
extern (C++) __gshared
ClassDeclaration typeinfostaticarray;
extern (C++) __gshared
ClassDeclaration typeinfoassociativearray;
extern (C++) __gshared
ClassDeclaration typeinfovector;
extern (C++) __gshared
ClassDeclaration typeinfoenum;
extern (C++) __gshared
ClassDeclaration typeinfofunction;
extern (C++) __gshared
ClassDeclaration typeinfodelegate;
extern (C++) __gshared
ClassDeclaration typeinfotypelist;
extern (C++) __gshared
ClassDeclaration typeinfoconst;
extern (C++) __gshared
ClassDeclaration typeinfoinvariant;
extern (C++) __gshared
ClassDeclaration typeinfoshared;
extern (C++) __gshared
ClassDeclaration typeinfowild;
extern (C++) __gshared
TemplateDeclaration rtinfo;
extern (C++) __gshared
Type[TMAX] basic;
extern (D) __gshared
StringTable!Type stringtable;
}

Members

Functions

addMod
Type addMod(MOD mod)

Add MODxxxx bits to existing type. We're adding, not replacing, so adding const to a shared type => "shared const"

addSTC
Type addSTC(StorageClass stc)

Apply STCxxxx bits to existing type. Use *before* semantic analysis is run.

addStorageClass
Type addStorageClass(StorageClass stc)

Add storage class modifiers to type.

alignment
structalign_t alignment()

Return alignment to use for this type.

baseElemOf
Type baseElemOf()

If this is a type of static array, return its base element type.

castMod
Type castMod(MOD mod)

Apply MODxxxx bits to existing type.

check
void check()

Look for bugs in constructing types.

checkAliasThisRec
bool checkAliasThisRec()

Check whether this type has endless alias this recursion.

checkComplexTransition
bool checkComplexTransition(Loc loc, Scope* sc)

https://issues.dlang.org/show_bug.cgi?id=14488

Check if the inner most base type is complex or imaginary. Should only give alerts when set to emit transitional messages.

checkDeprecated
void checkDeprecated(Loc loc, Scope* sc)

Check type to see if it is based on a deprecated symbol.

constConv
MATCH constConv(Type to)

Determine if converting 'this' to 'to' is an identity operation, a conversion to const operation, or the types aren't the same.

constOf
Type constOf()

Convert to 'const'.

covariant
Covariant covariant(Type t, StorageClass* pstc, bool cppCovariant)

Covariant means that 'this' can substitute for 't', i.e. a pure function is a match for an impure type.

deduceWild
MOD deduceWild(Type t, bool isRef)

Compute MOD bits matching this argument type to wild parameter type.

defaultInitLiteral
Expression defaultInitLiteral(Loc loc)

Use when we prefer the default initializer to be a literal, rather than a global immutable variable.

fixTo
void fixTo(Type t)

For our new type 'this', which is type-constructed from t, fill in the cto, ito, sto, scto, wto shortcuts.

getUniqueID
size_t getUniqueID()

Returns a non-zero unique ID for this Type, or returns 0 if the Type does not (yet) have a unique ID. If semantic() has not been run, 0 is returned.

hasInvariant
bool hasInvariant()
hasPointers
bool hasPointers()

Return !=0 if type has pointers that need to be scanned by the GC during a collection cycle.

hasSystemFields
bool hasSystemFields()

Detect if this is an unsafe type because of the presence of @system members

hasVoidInitPointers
bool hasVoidInitPointers()

Detect if type has pointer fields that are initialized to void. Local stack variables with such void fields can remain uninitialized, leading to pointer bugs.

hasWild
int hasWild()

Return !=0 if the type or any of its subtypes is wild.

immutableOf
Type immutableOf()

Convert to 'immutable'.

implicitConvTo
MATCH implicitConvTo(Type to)

Determine if 'this' can be implicitly converted to type 'to'.

isAssignable
bool isAssignable()

When T is mutable, Given: T a, b; Can we bitwise assign: a = b; ?

isBoolean
bool isBoolean()

Returns true if T can be converted to boolean value.

isFunction_Delegate_PtrToFunction
inout(TypeFunction) isFunction_Delegate_PtrToFunction()

Is this type a function, delegate, or pointer to a function?

isPtrToFunction
inout(TypeFunction) isPtrToFunction()

Is this type a pointer to a function?

merge2
Type merge2()

This version does a merge even if the deco is already computed. Necessary for types that have a deco, but are not merged.

modToBuffer
void modToBuffer(OutBuffer* buf)

Store this type's modifier name into buf.

modToChars
char* modToChars()

Return this type's modifier name.

mutableOf
Type mutableOf()

Make type mutable.

needsCopyOrPostblit
bool needsCopyOrPostblit()

true if when type is copied, it needs a copy constructor or postblit applied. Only applies to value types, not ref types.

needsDestruction
bool needsDestruction()

true if when type goes out of scope, it needs a destructor applied. Only applies to value types, not ref types.

needsNested
bool needsNested()
nextOf
Type nextOf()

If this is a type of something, return that something.

nullAttributes
Type nullAttributes()

Return a copy of this type with all attributes null-initialized. Useful for creating a type with different modifiers.

numberOfElems
uint numberOfElems(Loc loc)

Compute number of elements for a (possibly multidimensional) static array, or 1 for other types.

sizemask
uinteger_t sizemask()

Return the mask that an integral type will fit into.

toBasetype
Type toBasetype()

If this is a shell around another type, get that other type.

toChars
const(char)* toChars()

For pretty-printing a type.

toHeadMutable
inout(Type) toHeadMutable()

Return type with the top level of it being mutable.

toPrettyChars
char* toPrettyChars(bool QualifyTypes)

For pretty-printing a type.

unSharedOf
Type unSharedOf()

Make type unshared. 0 => 0 const => const immutable => immutable shared => 0 shared const => const wild => wild wild const => wild const shared wild => wild shared wild const => wild const

wildOf
Type wildOf()

Convert to 'wild'.

Static functions

deinitialize
void deinitialize()

Deinitializes the global state of the compiler.

Inherited Members

From ASTNode

accept
void accept(Visitor v)

Visits this AST node using the given visitor.

Meta