View source code
Display the source code in dmd/mtype.d from which this page was generated on github.
Report a bug
If you spot a problem with this page, click here to create a Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using local clone.

Module dmd.mtype

Defines a D type.

Documentation

https://dlang.org/phobos/dmd_mtype.html

Coverage

https://codecov.io/gh/dlang/dmd/src/master/src/dmd/mtype.d

Functions

NameDescription
attributesApply(tf, dg, 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(stc) Computes how a parameter may be returned. Shrinking the representation is necessary because StorageClass is so wide
isAggregate(t) If the type is a class or struct, returns the symbol for it, else null.
isCopyable(t) Determine if type t is copyable.
isIndexableNonAggregate(t) Determine if type t can be indexed or sliced given that it is not an aggregate with operator overloads.
isSomeChar(ty) Returns true if ty is char, wchar, or dchar
modifiersApply(tf, 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.
MODimplicitConv(modfrom, modto) Return !=0 if modfrom can be implicitly converted to modto
MODmerge(mod1, mod2) Merge mod bits to form common mod.
MODmethodConv(modfrom, modto) Return MATCH.exact or MATCH.constant if a method of type '() modfrom' can call a method of type '() modto'.
MODtoBuffer(buf, mod) Store modifier name into buf.
MODtoChars(mod)
ModToStc(mod) Convert MODxxxx to STCxxx
MODtoString(mod)
mutabilityOfType(isref, t) Determine mutability of indirections in (ref) t.
toAutoQualChars(t1, t2) For printing two types with qualification when necessary.
toBooleanVector(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(sr) Give us a nice string for debugging purposes.
trustToString(trust) Pick off one of the trust flags from trust, and return a string representation of it.
visitTYCase(handler) CTFE-only helper function for VisitInitializer.
VisitType(t) Dispatch to function based on static type of Type.

Classes

NameDescription
Parameter
Type
TypeAArray
TypeArray
TypeBasic
TypeClass
TypeDArray Dynamic array, no dimension
TypeDelegate
TypeEnum
TypeError
TypeFunction
TypeIdentifier
TypeInstance Similar to TypeIdentifier, but with a TemplateInstance as the root
TypeMixin Implements mixin types.
TypeNext
TypeNoreturn
TypeNull
TypePointer
TypeQualified
TypeReference
TypeReturn
TypeSArray Static array, one with a fixed dimension
TypeSlice This is so we can slice a TypeTuple
TypeStruct
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 This is a shell containing a TraitsExp that can be either resolved to a type or to a symbol.
TypeTuple
TypeTypeof
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]

Structs

NameDescription
ParameterList Represents a function's formal parameters + variadics info. Length, indexing and iteration are based on a depth-first tuple expansion.

Enums

NameDescription
Covariant Result of a check whether two types are covariant
DotExpFlag dotExp() bit flags
ScopeRef Classification of 'scope-return-ref' possibilities

Authors

Walter Bright

License

Boost License 1.0