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.

Class dmd.mtype.Type

class Type
  : ASTNode ;


addMod (mod) Add MODxxxx bits to existing type. We're adding, not replacing, so adding const to a shared type => "shared const"
addSTC (stc) Apply STCxxxx bits to existing type. Use *before* semantic analysis is run.
addStorageClass (stc) Add storage class modifiers to type.
alignment () Return alignment to use for this type.
baseElemOf () If this is a type of static array, return its base element type.
castMod (mod) Apply MODxxxx bits to existing type.
check () Look for bugs in constructing types.
checkComplexTransition (loc, sc)
checkDeprecated (loc, sc) Check type to see if it is based on a deprecated symbol.
constConv (to) Determine if converting 'this' to 'to' is an identity operation, a conversion to const operation, or the types aren't the same.
constOf () Convert to 'const'.
covariant (t, pstc) Covariant means that 'this' can substitute for 't', i.e. a pure function is a match for an impure type.
deduceWild (t, isRef) Compute MOD bits matching this argument type to wild parameter type.
defaultInitLiteral (loc) Use when we prefer the default initializer to be a literal, rather than a global immutable variable.
deinitialize () Deinitializes the global state of the compiler.
fixTo (t) For our new type 'this', which is type-constructed from t, fill in the cto, ito, sto, scto, wto shortcuts.
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 ()
hasPointers () Return !=0 if type has pointers that need to be scanned by the GC during a collection cycle.
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 () Return !=0 if the type or any of its subtypes is wild.
immutableOf () Convert to 'immutable'.
implicitConvTo (to) Determine if 'this' can be implicitly converted to type 'to'.
isAssignable () When T is mutable,
isBoolean () Returns true if T can be converted to boolean value.
isFunction_Delegate_PtrToFunction () Is this type a function, delegate, or pointer to a function?
isPtrToFunction () Is this type a pointer to a function?
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 (buf) Store this type's modifier name into buf.
modToChars () Return this type's modifier name.
mutableOf () Make type mutable.
needsCopyOrPostblit () true if when type is copied, it needs a copy constructor or postblit applied. Only applies to value types, not ref types.
needsDestruction () true if when type goes out of scope, it needs a destructor applied. Only applies to value types, not ref types.
needsNested ()
nextOf () If this is a type of something, return that something.
nullAttributes () Return a copy of this type with all attributes null-initialized. Useful for creating a type with different modifiers.
numberOfElems (loc) Compute number of elements for a (possibly multidimensional) static array, or 1 for other types.
sizemask () Return the mask that an integral type will fit into.
toBasetype () If this is a shell around another type, get that other type.
toChars () For pretty-printing a type.
toHeadMutable () Return type with the top level of it being mutable.
toPrettyChars (QualifyTypes) For pretty-printing a 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 () Convert to 'wild'.
accept (v) Visits this AST node using the given visitor.
factory (classname) Create instance of class specified by the fully qualified name classname. The class must either have no constructors or have a default constructor.
opCmp (o) Compare with another Object obj.
opEquals (o) Test whether this is equal to o. The default implementation only compares by identity (using the is operator). Generally, overrides and overloads for opEquals should attempt to compare objects by their contents. A class will most likely want to add an overload that takes your specific type as the argument and does the content comparison. Then you can override this and forward it to your specific typed overload with a cast. Remember to check for null on the typed overload.
toHash () Compute hash function for Object.
toString ()
toString () Convert Object to a human readable string.


Walter Bright


Boost License 1.0