Movatterモバイル変換


[0]ホーム

URL:


D Logo
Menu
Search

Library Reference

version 2.112.0

overview

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 usinga local clone.

dmd.ctfeexpr

CTFE for expressions involving pointers, slices, array concatenation etc.
Authors:
Walter Bright
License:
Boost License 1.0

Sourcectfeexpr.d

Documentationhttps://dlang.org/phobos/dmd_ctfeexpr.html

Coveragehttps://codecov.io/gh/dlang/dmd/src/master/compiler/src/dmd/ctfeexpr.d

structUnionExp;
pure nothrow @safe intfindFieldIndexByName(const StructDeclarationsd, const VarDeclarationv);
Same as getFieldIndex, but checks for a direct match with the VarDeclaration
Returns:
index of the field, or -1 if not found
nothrow boolneedToCopyLiteral(const Expressionexpr);
Aggregate literals (AA/string/array/struct)
ExpressionresolveSlice(Expressione, UnionExp*pue = null);
If e is a SliceExp, constant fold it.
Parameters:
Expressioneexpression to resolve
UnionExp*pueif not null, store resulting expression here
Returns:
resulting expression
ArrayLiteralExpcreateBlockDuplicatedArrayLiteral(UnionExp*pue, Locloc, Typetype, Expressionelem, size_tdim);
Helper for NewExp Create an array literal consisting of 'elem' duplicated 'dim' times.
Parameters:
UnionExp*puewhere to store result
Loclocsource location where the interpretation occurs
Typetypetarget type of the result
Expressionelemthe source of array element, it will be owned by the result
size_tdimelement number of the result
Returns:
Constructed ArrayLiteralExp
StringExpcreateBlockDuplicatedStringLiteral(UnionExp*pue, Locloc, Typetype, dcharvalue, size_tdim, ubytesz);
Helper for NewExp Create a string literal consisting of 'value' duplicated 'dim' times.
nothrow boolisTypeInfo_Class(const Typetype);
TypeInfo operations
boolisPointer(Typet);
Pointer operations
boolpointToSameMemoryBlock(Expressionagg1, Expressionagg2);
Return true if agg1 and agg2 are pointers to the same memory block
boolisCtfeComparable(Expressione);
Constant folding, with support for CTFEReturn true if non-pointer expression e can be comparedwith >,is, ==, etc, using ctfeCmp, ctfeEqual, ctfeIdentity
nothrow @safe boolspecificCmp(EXPop, intrawCmp);
Returns cmp OP 0; where OP is ==, !=, <, >=, etc. Result is 0 or 1
nothrow @safe boolintUnsignedCmp(EXPop, dinteger_tn1, dinteger_tn2);
Returns e1 OP e2; where OP is ==, !=, <, >=, etc. Result is 0 or 1
nothrow @safe boolintSignedCmp(EXPop, sinteger_tn1, sinteger_tn2);
Returns e1 OP e2; where OP is ==, !=, <, >=, etc. Result is 0 or 1
nothrow @safe boolrealCmp(EXPop, real_tr1, real_tr2);
Returns e1 OP e2; where OP is ==, !=, <, >=, etc. Result is 0 or 1
boolctfeEqual(Locloc, EXPop, Expressione1, Expressione2);
Evaluate ==, !=. Resolves slices before comparing. Returns 0 or 1
boolctfeIdentity(Locloc, EXPop, Expressione1, Expressione2);
Evaluate is, !is. Resolves slices before comparing. Returns 0 or 1
boolctfeCmp(Locloc, EXPop, Expressione1, Expressione2);
Evaluate >,<=, etc. Resolves slices before comparing. Returns 0 or 1
voidassignInPlace(Expressiondest, Expressionsrc);
Assignment helper functions
ExpressionchangeArrayLiteralLength(UnionExp*pue, Locloc, TypeArrayarrayType, Expressionoldval, size_toldlen, size_tnewlen);
Given array literal oldval of type ArrayLiteralExp or StringExp, of lengtholdlen, 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.
boolisCtfeValueValid(Expressionnewval);
CTFE Sanity Checks
UnionExpvoidInitLiteral(Typet, VarDeclarationvar);
Void initialization
Copyright © 1999-2026 by theD Language Foundation | Page generated byDdoc on Fri Feb 20 17:56:22 2026

[8]ページ先頭

©2009-2026 Movatter.jp