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
a local clone.
dmd.mtype
Compiler implementation of the
D programming language.
Authors:
License:
Source mtype.d
Documentation https://dlang.org/phobos/dmd_mtype.html
- pure nothrow @nogc @safe bool
MODimplicitConv
(MODmodfrom
, MODmodto
); - Return !=0 if
modfrom
can be implicitly converted tomodto
- pure nothrow @nogc @safe MATCH
MODmethodConv
(MODmodfrom
, MODmodto
); - Return MATCH.exact or MATCH.constant if a method of type '()
modfrom
' can call a method of type '()modto
'. - pure nothrow @nogc @safe MOD
MODmerge
(MODmod1
, MODmod2
); - Merge mod bits to form common mod.
- nothrow void
MODtoBuffer
(OutBuffer*buf
, MODmod
); - Store modifier name into
buf
. - nothrow char*
MODtoChars
(MODmod
); - Return modifier name.
- pure nothrow @nogc @safe StorageClass
ModToStc
(uintmod
); - Convert MODxxxx to STCxxx
- Type
stripDefaultArgs
(Typet
); - Strip all parameter's idenfiers and their default arguments for merging types. If some of parameter types or return type are function pointer, delegate, or the types which contains either, then strip also from them.
- Expression
semanticLength
(Scope*sc
, Typet
, Expressionexp
); - This evaluates
exp
while setting length to be the number of elements in the tuplet
. - abstract class
Type
: dmd.root.rootobject.RootObject; -
- final int
covariant
(Typet
, StorageClass*pstc
= null, boolfix17349
= true); - Covariant means that 'this' can substitute for '
t
', i.e. a pure function is a match for an impure type.Parameters:Type t
type 'this' is covariant
withStorageClass* pstc
if not null
, store STCxxxx which would make itcovariant
bool fix17349
enable fix https://issues.dlang.org/show_bug.cgi?id=17349 Returns:0 types are distinct 1 this iscovariant
witht
2 arguments match as far as overloading goes, but types are notcovariant
3 cannot determine covariance because of forward references *pstc
STCxxxx which would make itcovariant
- final const(char)*
toChars
();
final char*toPrettyChars
(boolQualifyTypes
= false); - For pretty-printing a type.
- final 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.
- final nothrow void
modToBuffer
(OutBuffer*buf
); - Store this type's modifier name into
buf
. - final nothrow char*
modToChars
(); - Return this type's modifier name.
- final int
modifiersApply
(void*param
, int function(void*, const(char)*)fp
); - For each active modifier (MODFlags.const_, MODFlags.immutable_, etc) call
fp
with a void* for the workparam
and a string representation of the attribute. - bool
isAssignable
(); - When T is mutable,
Given T a, b; Can we bitwise assign: a = b; ?
- bool
isBoolean
(); - Returns
true
if T can be converted to boolean value. - void
checkDeprecated
(ref const Locloc
, Scope*sc
); - Check type to see if it is based on a deprecated symbol.
- final nothrow Type
nullAttributes
(); - Return a copy of this type with all attributes
null
-initialized. Useful for creating a type with different modifiers. - final Type
constOf
(); - Convert to 'const'.
- final Type
immutableOf
(); - Convert to 'immutable'.
- final Type
mutableOf
(); - Make type mutable.
- final 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
- final Type
wildOf
(); - Convert to 'wild'.
- final void
fixTo
(Typet
); - For our new type 'this', which is type-constructed from
t
, fill in the cto, ito, sto, scto, wto shortcuts. - final void
check
(); - Look for bugs in constructing types.
- final Type
addSTC
(StorageClassstc
); - Apply STCxxxx bits to existing type. Use *before* semantic analysis is run.
- final Type
castMod
(MODmod
); - Apply MODxxxx bits to existing type.
- final Type
addMod
(MODmod
); - Add MODxxxx bits to existing type. We're adding, not replacing, so adding const to a shared type => "shared const"
- Type
addStorageClass
(StorageClassstc
); - Add storage class modifiers to type.
- Type
toBasetype
(); - If this is a shell around another type, get that other type.
- MATCH
implicitConvTo
(Typeto
); - Determine if 'this' can be implicitly converted
to
type 'to
'.Returns:MATCH.nomatch, MATCH.convert, MATCH.constant, MATCH.exact - MATCH
constConv
(Typeto
); - Determine if converting 'this'
to
'to
' is an identity operation, a conversionto
const operation, or the types aren't the same.Returns:MATCH.exact 'this' == 'to
' MATCH.constant 'to
' is const MATCH.nomatch conversionto
mutable or invariant - ubyte
deduceWild
(Typet
, boolisRef
); - Return MOD bits matching this type to wild parameter type (tprm).
- Type
toHeadMutable
(); - Return type with the top level of it being mutable.
- Expression
getProperty
(ref const Locloc
, Identifierident
, intflag
); - Calculate built-in properties which just the type is necessary.If
flag
& 1, don't report "not a property" error and just return NULL. - enum
DotExpFlag
: int; - dotExp() bit flags
- Expression
dotExp
(Scope*sc
, Expressione
, Identifierident
, intflag
); - Access the members of the object
e
. This type is same ase
.type.Parameters:Scope* sc
instantiating scope Expression e
expression to convert Identifier ident
identifier being used int flag
DotExpFlag bit flags Returns:resulting expression withe
.ident
resolved - structalign_t
alignment
(); - Return
alignment
to use for this type. - final Expression
noMember
(Scope*sc
, Expressione
, Identifierident
, intflag
); - Figures out what to do with an undefined member reference for classes and structs.If
flag
& 1, don't report "not a property" error and just return NULL. - Expression
defaultInitLiteral
(ref const Locloc
); - Use when we prefer the default initializer to be a literal, rather than a global immutable variable.
- void
resolve
(ref const Locloc
, Scope*sc
, Expression*pe
, Type*pt
, Dsymbol*ps
, boolintypeid
= false); - Resolve 'this' type to either type, symbol, or expression. If errors happened, resolved to Type.terror.
- final void
resolveExp
(Expressione
, Type*pt
, Expression*pe
, Dsymbol*ps
); - Normalize
e
as the result of Type.resolve() process. - const int
hasWild
(); - Return !=0 if the type or any of its subtypes is wild.
- bool
hasPointers
(); - Return !=0 if type has pointers that need to be scanned by the GC during a collection cycle.
- 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.Returns:
true
if so - Type
nextOf
(); - If this is a type of something, return that something.
- final Type
baseElemOf
(); - If this is a type of static array, return its base element type.
- final uinteger_t
sizemask
(); - Return the mask that an integral type will fit into.
- bool
needsDestruction
(); true
if when type goes out of scope, it needs a destructor applied. Only applies to value types, not ref types.- bool
needsNested
(); - final bool
checkComplexTransition
(ref const Locloc
, 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.Parameters:
Loc loc
The source location. Scope* sc
scope of the type
- class
TypeError
: dmd.mtype.Type; - abstract class
TypeNext
: dmd.mtype.Type; -
- final Type
nextOf
(); - For TypeFunction,
nextOf
() can return NULL if the function return type is meant to be inferred, and semantic() hasn't yet ben run on the function. After semantic(), it must no longer be NULL.
- class
TypeBasic
: dmd.mtype.Type; - class
TypeVector
: dmd.mtype.Type; - 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]
- class
TypeArray
: dmd.mtype.TypeNext; - class
TypeSArray
: dmd.mtype.TypeArray; - Static array, one with a fixed dimension
- bool
needsNested
();
- class
TypeDArray
: dmd.mtype.TypeArray; - Dynamic array, no dimension
- class
TypeAArray
: dmd.mtype.TypeArray; - class
TypePointer
: dmd.mtype.TypeNext; - class
TypeReference
: dmd.mtype.TypeNext; - class
TypeFunction
: dmd.mtype.TypeNext; -
- void
purityLevel
(); - Set 'purity' field of 'this'. Do this lazily, as the parameter types might be forward referenced.
- bool
hasLazyParameters
(); - Return
true
if there are lazy parameters. - bool
parameterEscapes
(Parameterp
); - Examine function signature for parameter
p
and see if the value ofp
can 'escape' the scope of the function. This is useful to minimize the needed annotations for the parameters.Parameters:Parameter p
parameter to this function Returns:true
if escapes via assignment to global or through a parameter - final StorageClass
parameterStorageClass
(Parameterp
); - Take the specified storage class for
p
, and use the function signature to infer whether STC.scope_ and STC.return_ should be OR'd in. (This will not affect the name mangling.)Parameters:Parameter p
one of the parameters to 'this' Returns:storage class with STC.scope_ or STC.return_ OR'd in - int
attributesApply
(void*param
, int function(void*, const(char)*)fp
, TRUSTformattrustFormat
= TRUSTformatDefault); - For each active attribute (ref/const/nogc/etc) call
fp
with a void* for the workparam
and a string representation of the attribute. - MATCH
callMatch
(Typetthis
, Expressions*args
, intflag
= 0, const(char)**pMessage
= null); - '
args
' are being matched to function 'this' Determine match level.Input
flag
1 performing a partial ordering matchpMessage
address to store error message, ornull
Returns:MATCHxxxx
- class
TypeDelegate
: dmd.mtype.TypeNext; - abstract class
TypeQualified
: dmd.mtype.Type; -
- final void
resolveTupleIndex
(ref const Locloc
, Scope*sc
, Dsymbols
, Expression*pe
, Type*pt
, Dsymbol*ps
, RootObjectoindex
); - Resolve a tuple index.
- final void
resolveHelper
(ref const Locloc
, Scope*sc
, Dsymbols
, Dsymbolscopesym
, Expression*pe
, Type*pt
, Dsymbol*ps
, boolintypeid
= false); - Takes an array of Identifiers and figures out if it represents a Type or an Expression.
Output if expression, *
pe
is set if type, *pt
is set
- class
TypeIdentifier
: dmd.mtype.TypeQualified; -
- void
resolve
(ref const Locloc
, Scope*sc
, Expression*pe
, Type*pt
, Dsymbol*ps
, boolintypeid
= false); - Takes an array of Identifiers and figures out if it represents a Type or an Expression.
Output if expression, *
pe
is set if type, *pt
is set - Dsymbol
toDsymbol
(Scope*sc
); - See if type resolves to a symbol, if so, return that symbol.
- class
TypeInstance
: dmd.mtype.TypeQualified; - Similar to TypeIdentifier, but with a TemplateInstance as the root
- class
TypeTypeof
: dmd.mtype.TypeQualified; - class
TypeReturn
: dmd.mtype.TypeQualified; - class
TypeStruct
: dmd.mtype.Type; -
- Expression
defaultInitLiteral
(ref const Locloc
); - Use when we prefer the default initializer to be a literal, rather than a global immutable variable.
- class
TypeEnum
: dmd.mtype.Type; - class
TypeClass
: dmd.mtype.Type; - class
TypeTuple
: dmd.mtype.Type; -
- this(Expressions*
exps
); - Form TypeTuple from the types of the expressions. Assume
exps
[] is already tuple expanded. - this();
- Type tuple with 0, 1 or 2 types in it.
- class
TypeSlice
: dmd.mtype.TypeNext; - This is so we can slice a TypeTuple
- class
TypeNull
: dmd.mtype.Type; - class
Parameter
: dmd.root.rootobject.RootObject; -
- Type
isLazyArray
(); - Determine if parameter is a lazy array of delegates. If so, return the return type of those delegates. If not, return NULL.Returns T if the type is one of the following forms: T delegate()[] T delegate()[dim]
- static int
isTPL
(Parameters*parameters
); - Determine if parameter list is really a template parameter list (i.e. it has auto or alias
parameters
) - static size_t
dim
(Parameters*parameters
); - Determine number of arguments, folding in tuples.
- static Parameter
getNth
(Parameters*parameters
, size_tnth
, size_t*pn
= null); - Get
nth
Parameter, folding in tuples.Returns:Parameter*nth
Parameter NULL not found, *pn
gets incremented by the number of Parameters - static int
_foreach
(Parameters*parameters
, scope ForeachDgdg
, size_t*pn
= null); - Expands tuples in args in depth first order. Calls
dg
(void *ctx, size_t argidx, Parameter *arg) for each Parameter. Ifdg
returns !=0, stops and returns that value else returns 0. Use this function to avoid the O(N + N^2/2) complexity of calculating dim and calling N times getNth. - final const pure nothrow @nogc @safe bool
isCovariant
(boolreturnByRef
, const Parameterp
); - Compute covariance of parameters this and
p
as determined by the storage classes of both.Parameters:bool returnByRef
true
if the function returns by refParameter p
Parameter to compare with Returns:true
= this can be used in place ofp
false
= nope
- const(char*)[2]
toAutoQualChars
(Typet1
, Typet2
); - For printing two types with qualification when necessary.Parameters:
Type t1
The first type to receive the type name for Type t2
The second type to receive the type name for Returns:The fully-qualified names of both types if the two type names are not the same, or the unqualified names of both types if the two type names are the same.
Copyright © 1999-2018 by the D Language Foundation | Page generated by
Ddoc on Tue Mar 13 17:31:29 2018