dmd.mtype

Defines a D type.

Members

Classes

Parameter
class Parameter
Type
class Type
TypeAArray
class TypeAArray
TypeArray
class TypeArray
TypeBasic
class TypeBasic
TypeClass
class TypeClass
TypeDArray
class TypeDArray

Dynamic array, no dimension

TypeDelegate
class TypeDelegate
TypeEnum
class TypeEnum
TypeError
class TypeError
TypeFunction
class TypeFunction
TypeIdentifier
class TypeIdentifier
TypeInstance
class TypeInstance

Similar to TypeIdentifier, but with a TemplateInstance as the root

TypeMixin
class TypeMixin

Implements mixin types.

TypeNext
class TypeNext
TypeNoreturn
class TypeNoreturn
TypeNull
class TypeNull
TypePointer
class TypePointer
TypeQualified
class TypeQualified
TypeReference
class TypeReference
TypeReturn
class TypeReturn
TypeSArray
class TypeSArray

Static array, one with a fixed dimension

TypeSlice
class TypeSlice

This is so we can slice a TypeTuple

TypeStruct
class TypeStruct
TypeTag
class TypeTag

Unlike D, C can declare/define struct/union/enum tag names inside Declarators, instead of separately as in D. The order these appear in the symbol table must be in lexical order. There isn't enough info at the parsing stage to determine if it's a declaration or a reference to an existing name, so this Type collects the necessary info and defers it to semantic().

TypeTraits
class TypeTraits

This is a shell containing a TraitsExp that can be either resolved to a type or to a symbol.

TypeTuple
class TypeTuple
TypeTypeof
class TypeTypeof
TypeVector
class TypeVector

The basetype must be one of: byte[16],ubyte[16],short[8],ushort[8],int[4],uint[4],long[2],ulong[2],float[4],double[2] For AVX: byte[32],ubyte[32],short[16],ushort[16],int[8],uint[8],long[4],ulong[4],float[8],double[4]

Enums

Covariant
enum Covariant

Result of a check whether two types are covariant

DotExpFlag
enum DotExpFlag

dotExp() bit flags

ScopeRef
enum ScopeRef

Classification of 'scope-return-ref' possibilities

Functions

MODimplicitConv
bool MODimplicitConv(MOD modfrom, MOD modto)

Return !=0 if modfrom can be implicitly converted to modto

MODmerge
MOD MODmerge(MOD mod1, MOD mod2)

Merge mod bits to form common mod.

MODmethodConv
MATCH MODmethodConv(MOD modfrom, MOD modto)

Return MATCH.exact or MATCH.constant if a method of type '() modfrom' can call a method of type '() modto'.

MODtoBuffer
void MODtoBuffer(OutBuffer buf, MOD mod)

Store modifier name into buf.

MODtoChars
const(char)* MODtoChars(MOD mod)
MODtoString
string MODtoString(MOD mod)
ModToStc
StorageClass ModToStc(uint mod)

Convert MODxxxx to STCxxx

attributesApply
void attributesApply(TypeFunction tf, void delegate(string) dg, TRUSTformat trustFormat)

For each active attribute (ref/const/nogc/etc) call fp with a void* for the work param and a string representation of the attribute.

buildScopeRef
ScopeRef buildScopeRef(StorageClass stc)

Computes how a parameter may be returned. Shrinking the representation is necessary because StorageClass is so wide

getException
TypeIdentifier getException()
getThrowable
TypeIdentifier getThrowable()
isAggregate
AggregateDeclaration isAggregate(Type t)

If the type is a class or struct, returns the symbol for it, else null.

isCopyable
bool isCopyable(Type t)

Determine if type t is copyable.

isIndexableNonAggregate
bool isIndexableNonAggregate(Type t)

Determine if type t can be indexed or sliced given that it is not an aggregate with operator overloads.

isSomeChar
bool isSomeChar(TY ty)

Returns true if ty is char, wchar, or dchar

modifiersApply
void modifiersApply(TypeFunction tf, void delegate(string) dg)

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

mutabilityOfType
int mutabilityOfType(bool isref, Type t)

Determine mutability of indirections in (ref) t.

toAutoQualChars
const(char*)[2] toAutoQualChars(Type t1, Type t2)

For printing two types with qualification when necessary.

toBooleanVector
TypeVector toBooleanVector(TypeVector tv)

Creates an appropriate vector type for tv that will hold one boolean result for each element of the vector type. The result of vector comparisons is a single or doubleword mask of all 1s (comparison true) or all 0s (comparison false). This SIMD mask type does not have an equivalent D type, however its closest equivalent would be an integer vector of the same unit size and length.

toChars
const(char)* toChars(ScopeRef sr)

Give us a nice string for debugging purposes.

trustToString
string trustToString(TRUST trust)

Pick off one of the trust flags from trust, and return a string representation of it.

visitTYCase
string visitTYCase(string handler)

CTFE-only helper function for VisitInitializer.

Mixin templates

VisitType
mixintemplate VisitType(Result)

Dispatch to function based on static type of Type.

Structs

ParameterList
struct ParameterList

Represents a function's formal parameters + variadics info. Length, indexing and iteration are based on a depth-first tuple expansion. https://dlang.org/spec/function.html#ParameterList

Meta