Type

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

Members

Enums

DotExpFlag
enum DotExpFlag

dotExp() bit flags

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.

checkComplexTransition
void checkComplexTransition(Loc loc)

Bugzilla 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
int covariant(Type t, StorageClass* pstc = null)

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

deduceWild
ubyte deduceWild(Type t, bool isRef)

Return MOD bits matching this type to wild parameter type (tprm).

defaultInitLiteral
Expression defaultInitLiteral(Loc loc)

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

dotExp
Expression dotExp(Scope* sc, Expression e, Identifier ident, int flag)

Access the members of the object e. This type is same as e->type.

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.

getProperty
Expression getProperty(Loc loc, Identifier ident, int flag)

Calculate built-in properties which just the type is necessary.

hasPointers
bool hasPointers()

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

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.

merge
Type merge()
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.

modifiersApply
int modifiersApply(void* param, int function(void*, const(char)*) fp)

For each active modifier (MODconst, MODimmutable, etc) call fp with a void* for the work param and a string representation of the attribute.

mutableOf
Type mutableOf()

Make type mutable.

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.

noMember
Expression noMember(Scope* sc, Expression e, Identifier ident, int flag)

Figures out what to do with an undefined member reference for classes and structs.

nullAttributes
Type nullAttributes()

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

resolve
void resolve(Loc loc, Scope* sc, Expression* pe, Type* pt, Dsymbol* ps, bool intypeid = false)

Resolve 'this' type to either type, symbol, or expression. If errors happened, resolved to Type.terror.

resolveExp
void resolveExp(Expression e, Type* pt, Expression* pe, Dsymbol* ps)

Normalize e as the result of Type.resolve() process.

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.

toExpression
Expression toExpression()

We've mistakenly parsed this as a type. Redo it as an Expression. NULL if cannot.

toHeadMutable
Type toHeadMutable()

Return type with the top level of it being mutable.

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'.

Meta