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.ctfeexpr
CTFE for expressions involving pointers, slices, array concatenation etc.
Authors:
License:
Source ctfeexpr.d
Documentation https://dlang.org/phobos/dmd_ctfeexpr.html
- struct
UnionExp
; - pure nothrow @safe int
findFieldIndexByName
(const StructDeclarationsd
, const VarDeclarationv
); - Same as getFieldIndex, but checks for a direct match with the VarDeclarationReturns:index of the field, or -1 if not found
- nothrow bool
needToCopyLiteral
(const Expressionexpr
); - Aggregate literals (AA/string/array/struct)
- Expression
resolveSlice
(Expressione
, UnionExp*pue
= null); - If e is a SliceExp, constant fold it.Parameters:
Expression e
expression to resolve UnionExp* pue
if not null, store resulting expression here Returns:resulting expression - ArrayLiteralExp
createBlockDuplicatedArrayLiteral
(UnionExp*pue
, const ref Locloc
, Typetype
, Expressionelem
, size_tdim
); - Helper for NewExp Create an array literal consisting of 'elem' duplicated 'dim' times.Parameters:
UnionExp* pue
where to store result Loc loc
source location where the interpretation occurs Type type
target type of the result Expression elem
the source of array element, it will be owned by the result size_t dim
element number of the result Returns:Constructed ArrayLiteralExp - StringExp
createBlockDuplicatedStringLiteral
(UnionExp*pue
, const ref Locloc
, Typetype
, dcharvalue
, size_tdim
, ubytesz
); - Helper for NewExp Create a string literal consisting of 'value' duplicated 'dim' times.
- nothrow bool
isTypeInfo_Class
(const Typetype
); - TypeInfo operations
- bool
isPointer
(Typet
); - Pointer operations
- bool
pointToSameMemoryBlock
(Expressionagg1
, Expressionagg2
); - Return true if agg1 and agg2 are pointers to the same memory block
- bool
isCtfeComparable
(Expressione
); - Constant folding, with support for CTFE Return true if non-pointer expression e can be compared with >,is, ==, etc, using ctfeCmp, ctfeEqual, ctfeIdentity
- nothrow @safe bool
specificCmp
(EXPop
, intrawCmp
); - Returns cmp OP 0; where OP is ==, !=, <, >=, etc. Result is 0 or 1
- nothrow @safe bool
intUnsignedCmp
(EXPop
, dinteger_tn1
, dinteger_tn2
); - Returns e1 OP e2; where OP is ==, !=, <, >=, etc. Result is 0 or 1
- nothrow @safe bool
intSignedCmp
(EXPop
, sinteger_tn1
, sinteger_tn2
); - Returns e1 OP e2; where OP is ==, !=, <, >=, etc. Result is 0 or 1
- nothrow @safe bool
realCmp
(EXPop
, real_tr1
, real_tr2
); - Returns e1 OP e2; where OP is ==, !=, <, >=, etc. Result is 0 or 1
- bool
ctfeEqual
(const ref Locloc
, EXPop
, Expressione1
, Expressione2
); - Evaluate ==, !=. Resolves slices before comparing. Returns 0 or 1
- bool
ctfeIdentity
(const ref Locloc
, EXPop
, Expressione1
, Expressione2
); - Evaluate is, !is. Resolves slices before comparing. Returns 0 or 1
- bool
ctfeCmp
(const ref Locloc
, EXPop
, Expressione1
, Expressione2
); - Evaluate >,<=, etc. Resolves slices before comparing. Returns 0 or 1
- void
assignInPlace
(Expressiondest
, Expressionsrc
); - Assignment helper functions
- Expression
changeArrayLiteralLength
(UnionExp*pue
, const ref Locloc
, TypeArrayarrayType
, Expressionoldval
, size_toldlen
, size_tnewlen
); - Given array literal oldval of type ArrayLiteralExp or StringExp, of length oldlen, change its length to newlen. If the newlen is longer than oldlen, all new elements will be set to the default initializer for the element type.
- bool
isCtfeValueValid
(Expressionnewval
); - CTFE Sanity Checks
- UnionExp
voidInitLiteral
(Typet
, VarDeclarationvar
); - Void initialization
Copyright © 1999-2024 by the D Language Foundation | Page generated by
Ddoc on (no date time)