dmd.expression
Defines the bulk of the classes which represent the AST at the expression level.
Specification: ($LINK2 https://dlang.org/spec/expression.html, Expressions)
License
Source: expression.d
Documentation: https://dlang.org/phobos/dmd_expression.html
-
Declaration
enumModifiable: int;Return value for
checkModifiable-
Declaration
noNot modifiable
-
Declaration
yesModifiable (the type is mutable)
-
Declaration
initializationModifiable because it is
initialization
-
-
Declaration
enumModifyFlags: int;Specifies how the checkModify deals with certain situations
-
Declaration
noneIssue error messages on invalid modifications of the variable
-
Declaration
noErrorNo errors are emitted for invalid modifications
-
Declaration
fieldAssignThe modification occurs for a subfield of the current variable
-
-
Declaration
inout(Expression)firstComma(inout Expressione);Find the first non-comma expression.
Parameters
ExpressioneExpressions connected by commas
Return Value
left-most non-comma expression
-
Declaration
inout(Expression)lastComma(inout Expressione);Find the last non-comma expression.
Parameters
ExpressioneExpressions connected by commas
Return Value
right-most non-comma expression
-
Declaration
FuncDeclarationhasThis(Scope*sc);Determine if
thisis available by walking up the enclosing scopes until a function is found.Parameters
Scope*scwhere to start looking for the enclosing function
Return Value
Found function if it satisfies
isThis(), otherwisenull -
Declaration
boolisNeedThisScope(Scope*sc, Declarationd);Determine if a
thisis needed to access.dParameters
Scope*sccontext
Declarationddeclaration to check
Return Value
truemeans athisis needed -
Declaration
boolisDotOpDispatch(Expressione);check
eis exp.opDispatch!(tiargs) or not It's used to switch to UFCS the semantic analysis path -
Declaration
voidexpandTuples(Expressions*exps);Expand tuples.
Input:
expsaray of ExpressionsOutput:
expsrewritten in place -
Declaration
TupleDeclarationisAliasThisTuple(Expressione);Expand alias this tuples.
-
Declaration
TemplateDeclarationgetFuncTemplateDecl(Dsymbols);If
is a function template, i.e. the only member of a template and that member is a function, return that template.sParameters
Dsymbolssymbol that might be a function template
Return Value
template for that function, otherwise
null -
Declaration
ExpressionvalueNoDtor(Expressione);If we want the value of this expression, but do not want to call the destructor on it.
-
Declaration
ExpressiondoCopyOrMove(Scope*sc, Expressione, Typet= null);Handle the postblit call on lvalue, or the move of rvalue.
Parameters
Scope*scthe scope where the expression is encountered
Expressionethe expression the needs to be moved or copied (source)
Typetif the struct defines a copy constructor, the type of the destination
Return Value
The expression that copy constructs or moves the value.
-
Declaration
structUnionExp; -
Declaration
boolRealIdentical(real_tx1, real_tx2);Test to see if two reals are the same. Regard NaN's as equivalent. Regard +0 and -0 as different.
Parameters
real_tx1first operand
real_tx2second operand
Return Value
trueifx1isx2elsefalse -
Declaration
DotIdExptypeDotIdExp(const ref Locloc, Typetype, Identifierident);TypeDotIdExp
-
Declaration
VarDeclarationexpToVariable(Expressione);Given an Expression, find the variable it really is.
Discussion
For example,
a[index]is reallya, ands.fis reallys.Parameters
ExpressioneExpression to look at
Return Value
variable if there is one,
nullif not -
Declaration
abstract classExpression: dmd.ast_node.ASTNode;-
Declaration
static voiddeinitialize();Deinitializes the global state of the compiler.
Discussion
This can be used to restore the state set by
_initto its original state. -
Declaration
final Expressioncopy();Does not do a deep
copy. -
Declaration
static Expressioncombine(Expressione1, Expressione2);Combine
e1ande2by CommaExp if both are not NULL. -
Declaration
static ExpressionextractLast(Expressione, out Expressione0);If '
e' is a tree of commas, returns the rightmost expression by stripping off it from the tree. The remained part of the tree is returned viae0. Otherwise 'e' is directly returned ande0is set to NULL. -
Declaration
boolisLvalue();Return !=0 if expression is an lvalue.
-
Declaration
ExpressiontoLvalue(Scope*sc, Expressione);Give error if we're not an lvalue. If we can, convert expression to be an lvalue.
-
Declaration
ExpressionresolveLoc(const ref Locloc, Scope*sc);Resolve __FILE__, __LINE__, __MODULE__, __FUNCTION__, __PRETTY_FUNCTION__, _FILE_FULL_PATH__ to
loc. -
Declaration
boolcheckType();Check that the expression has a valid type. If not, generates an error "... has no type".
Return Value
trueif the expression is not valid.Note: When this function returns
true,checkValue()should also returntrue. -
Declaration
boolcheckValue();Check that the expression has a valid value. If not, generates an error "... has no value".
Return Value
trueif the expression is not valid or has void type. -
Declaration
final boolcheckPurity(Scope*sc, FuncDeclarationf);Calling function
f. Check the purity, i.e. if we're in a pure function we can only call other pure functions. Returnstrueif error occurs. -
Declaration
final voidcheckOverridenDtor(Scope*sc, FuncDeclarationf, scope bool function(DtorDeclaration)check, const stringcheckName);Checks whether
is a generatedfDtorDeclarationthat hides a user-defined one which passeswhilecheckdoesn't (e.g. when the user defined dtor is pure but the generated dtor is not). In that case the method will identify and print all members causing the attribute missmatch.fParameters
Scope*scscope
FuncDeclarationfpotential
DtorDeclarationbool function(DtorDeclaration)checkcurrent
check(e.g. whether it's pure)stringcheckNamethe kind of
check(e.g."pure") -
Declaration
final boolcheckPurity(Scope*sc, VarDeclarationv);Accessing variable
v. Check for purity and safety violations. Returnstrueif error occurs. -
Declaration
final boolcheckSafety(Scope*sc, FuncDeclarationf);Calling function
f. Check the safety, i.e. if we're in a @safe function we can only call @safe or @trusted functions. Returnstrueif error occurs. -
Declaration
final boolcheckNogc(Scope*sc, FuncDeclarationf);Calling function
f. Check the @nogc-ness, i.e. if we're in a @nogc function we can only call other @nogc functions. Returnstrueif error occurs. -
Declaration
final boolcheckPostblit(Scope*sc, Typet);Check that the postblit is callable if
tis an array of structs. Returnstrueif error happens. -
Declaration
final boolcheckReadModifyWrite(EXPrmwOp, Expressionex= null);Check whether the expression allows RMW operations, error with rmw operator diagnostic if not.
exis the RHS expression, or NULL if ++/-- is used (for diagnostics) Returnstrueif error occurs. -
Declaration
ExpressionaddDtorHook(Scope*sc);Destructors are attached to VarDeclarations. Hence, if expression returns a temp that needs a destructor, make sure and create a VarDeclaration for that temp.
-
Declaration
final ExpressionaddressOf();Take address of expression.
-
Declaration
final Expressionderef();If this is a reference, dereference it.
-
Declaration
Optional!booltoBool();Statically evaluate this expression to a
boolif possibleReturn Value
an optional thath either contains the value or is empty
-
-
Declaration
classIntegerExp: dmd.expression.Expression;A compile-time known integer value
-
Declaration
IntegerExpliteral(int v)();Use this instead of creating new instances for commonly used literals such as 0 or 1.
Parameters: v = The value of the expression
Return Value
A static instance of the expression, typed as
Tint32. -
Declaration
static IntegerExpcreateBool(boolb);Use this instead of creating new instances for commonly used bools.
Parameters:
b= The value of the expressionReturn Value
A static instance of the expression, typed as
Type.tbool.
-
-
Declaration
classErrorExp: dmd.expression.Expression;Use this expression for error recovery.
Discussion
It should behave as a 'sink' to prevent further cascaded error messages.
-
Declaration
classVoidInitExp: dmd.expression.Expression;An uninitialized value, generated from void initializers.
-
Declaration
VarDeclarationvar;the variable from where the void value came from,
nullif not known -
Declaration
this(VarDeclarationvar);Useful for error messages
-
-
Declaration
classRealExp: dmd.expression.Expression;A compile-time known floating point number
-
Declaration
classComplexExp: dmd.expression.Expression;A compile-time complex number (deprecated)
-
Declaration
classIdentifierExp: dmd.expression.Expression;An identifier in the context of an expression (as opposed to a declaration)
Discussion
int x; // VarDeclaration with Identifier x++; // PostExp with IdentifierExp
-
Declaration
classDollarExp: dmd.expression.IdentifierExp;The dollar operator used when indexing or slicing an array. E.g
a[$],a[1 .. $]etc. -
Declaration
classDsymbolExp: dmd.expression.Expression;Won't be generated by parser.
-
Declaration
classThisExp: dmd.expression.Expression; -
Declaration
classSuperExp: dmd.expression.ThisExp; -
Declaration
classNullExp: dmd.expression.Expression;A compile-time known
nullvalueDiscussion
-
Declaration
classStringExp: dmd.expression.Expression;-
Declaration
const size_tnumberOfCodeUnits(inttynto= 0);Return the number of code units the string would be if it were re-encoded as
tynto.Parameters
inttyntocode unit type of the target encoding
Return Value
number of code units
-
Declaration
const voidwriteTo(void*dest, boolzero, inttyto= 0);Write the contents of the string to
dest. Use numberOfCodeUnits() to determine size of result.Parameters
void*destdestination
inttytoencoding type of the result
boolzeroadd terminating 0
-
Declaration
const pure dchargetCodeUnit(size_ti);Get the code unit at index
iParameters
size_tiindex
Return Value
code unit at index
i -
Declaration
voidsetCodeUnit(size_ti, dcharc);Set the code unit at index
itocParameters
size_tiindex
dcharccode unit to set it to
-
Declaration
StringExptoUTF8(Scope*sc);Convert string to char[].
-
Declaration
const pure nothrow @nogc intcompare(const StringExpse2);Compare two
StringExpby length, then valueDiscussion
The comparison is not the usual C-style comparison as seen with
strcmpormemcmp, but instead firstcomparebased on the length. This allows both faster lookup and sorting when comparing sparse data.
This ordering scheme is relied on by the string-switching feature. Code in Druntime'score.internal.switch_relies on this ordering when doing a binary search among case statements.
BothStringExpshould be of the same encoding.Parameters
StringExpse2String expression to
comparethistoReturn Value
0whenthisis equal tose2, a value greater than0ifthisshould be considered greater than, and a value less thanse20ifthisis lesser than.se2 -
Declaration
const const(char)[]toStringz();Convert string contents to a 0 terminated string, allocated by mem.xmalloc().
-
Declaration
const const(ubyte)[]peekData();Get a slice of the data.
-
Declaration
ubyte[]borrowData();Borrow a slice of the data, so the caller can modify it in-place (!)
-
Declaration
voidsetData(void*s, size_tlen, ubytesz);Set new string data.
thisbecomes the new owner of the data.
-
-
Declaration
classTupleExp: dmd.expression.Expression;A sequence of expressions
Discussion
alias AliasSeq(T...) = T; alias Tup = AliasSeq!(3, int, "abc");
-
Declaration
classArrayLiteralExp: dmd.expression.Expression;[ e1, e2, e3, ... ]
-
Declaration
Expressionbasis;If !is
null, elements[] can be sparse andbasisis used for the "default" element value. In other words, non-nullelements[i] overrides this 'basis' value.
-
-
Declaration
classAssocArrayLiteralExp: dmd.expression.Expression;[ key0 : value0, key1 : value1, ... ]
-
Declaration
enum intstageScrub;scrubReturnValue is running
-
Declaration
enum intstageSearchPointers;hasNonConstPointers is running
-
Declaration
enum intstageOptimize;optimize is running
-
Declaration
enum intstageApply;apply is running
-
Declaration
enum intstageInlineScan;inlineScan is running
-
Declaration
enum intstageToCBuffer;toCBuffer is running
-
Declaration
classStructLiteralExp: dmd.expression.Expression;sd( e1, e2, e3, ... )
-
Declaration
StructDeclarationsd;which aggregate this is for
-
Declaration
Expressions*elements;parallels sd.fields[] with
nullentries for fields to skip -
Declaration
Typestype;final type of result (can be different from sd's type)
-
Declaration
Symbol*sym;back end symbol to initialize with literal
-
Declaration
StructLiteralExporigin;pointer to the
origininstance of the expression. once a new expression is created,originis set to 'this'. anytime when an expression copy is created, 'origin' pointer is set to 'origin' pointer value of the original expression. -
Declaration
StructLiteralExpinlinecopy;those fields need to prevent a infinite recursion when one field of struct initialized with 'this' pointer.
-
Declaration
intstageflags;anytime when recursive function is calling, '
stageflags' marks with bit flag of current stage and unmarks before return from this function. 'inlinecopy' uses similar 'stageflags' and from multiple evaluation 'doInline' (with infinite recursion) of this expression. -
Declaration
booluseStaticInit;if this is
true, use the StructDeclaration's init symbol -
Declaration
boolisOriginal;used when moving instances to indicate
this is this.origin -
Declaration
ExpressiongetField(Typetype, uintoffset);Gets expression at
offsetoftype. Returns NULL if not found. -
Declaration
intgetFieldIndex(Typetype, uintoffset);Get index of field. Returns -1 if not found.
-
-
Declaration
classCompoundLiteralExp: dmd.expression.Expression;C11 6.5.2.5 ( type-name ) { initializer-list }
-
Declaration
Initializerinitializer;initializer-list
-
-
Declaration
classTypeExp: dmd.expression.Expression;Mainly just a placeholder
-
Declaration
classScopeExp: dmd.expression.Expression;Mainly just a placeholder of Package, Module, Nspace, and TemplateInstance (including TemplateMixin)
Discussion
A template instance that requires IFTI: foo!tiargs(fargs) // foo!tiargs is left until CallExp::semantic() or resolveProperties()
-
Declaration
classTemplateExp: dmd.expression.Expression;Mainly just a placeholder
-
Declaration
classNewExp: dmd.expression.Expression;newtype(arguments)
-
Declaration
classNewAnonClassExp: dmd.expression.Expression;class baseclasses { } (arguments)
-
Declaration
classSymbolExp: dmd.expression.Expression; -
Declaration
classSymOffExp: dmd.expression.SymbolExp;Offset from symbol
-
Declaration
classVarExp: dmd.expression.SymbolExp;Variable
-
Declaration
classOverExp: dmd.expression.Expression;Overload Set
-
Declaration
classFuncExp: dmd.expression.Expression;Function/Delegate literal
-
Declaration
classDeclarationExp: dmd.expression.Expression;Declaration of a symbol
Discussion
D grammar allows declarations only as statements. However in AST representation it can be part of any expression. This is used, for example, during internal syntax re-writes to inject hidden symbols.
-
Declaration
classTypeidExp: dmd.expression.Expression;typeid(int)
-
Declaration
classTraitsExp: dmd.expression.Expression;_traits(identifier, args...)
-
Declaration
classHaltExp: dmd.expression.Expression;Generates a halt instruction
Discussion
assert(0)gets rewritten to this withCHECKACTION.halt -
Declaration
classIsExp: dmd.expression.Expression;is(targ id tok tspec) is(targ id == tok2)
-
Declaration
abstract classUnaExp: dmd.expression.Expression;Base class for unary operators
-
Declaration
final ExpressionincompatibleTypes();The type for a unary expression is incompatible. Print error message.
Return Value
ErrorExp
-
Declaration
final voidsetNoderefOperand();Mark the operand as will never be dereferenced, which is useful info for @safe checks. Do before semantic() on operands rewrites them.
-
-
Declaration
abstract classBinExp: dmd.expression.Expression;Base class for binary operators
-
Declaration
final ExpressionincompatibleTypes();The types for a binary expression are incompatible. Print error message.
Return Value
ErrorExp
-
Declaration
final voidsetNoderefOperands();Mark the operands as will never be dereferenced, which is useful info for @safe checks. Do before semantic() on operands rewrites them.
-
-
Declaration
classBinAssignExp: dmd.expression.BinExp;Binary operator assignment,
+=-=*=etc. -
Declaration
classMixinExp: dmd.expression.Expression;A string mixin,
mixin("x") -
Declaration
classImportExp: dmd.expression.UnaExp;An import expression,
import("file.txt")Discussion
Not to be confused with module imports,
import std.stdio, which is anImportStatement
https://dlang.org/spec/expression.html#import_expressions -
Declaration
classAssertExp: dmd.expression.UnaExp;An assert expression,
assert(x == y) -
Declaration
classThrowExp: dmd.expression.UnaExp;throw <e1>as proposed by DIP 1034.Discussion
Replacement for the deprecated
ThrowStatementthat can be nested in other expression. -
Declaration
classDotIdExp: dmd.expression.UnaExp; -
Declaration
classDotTemplateExp: dmd.expression.UnaExp;Mainly just a placeholder
-
Declaration
classDotVarExp: dmd.expression.UnaExp; -
Declaration
classDotTemplateInstanceExp: dmd.expression.UnaExp;foo.bar!(args)
-
Declaration
classDelegateExp: dmd.expression.UnaExp; -
Declaration
classDotTypeExp: dmd.expression.UnaExp; -
Declaration
classCallExp: dmd.expression.UnaExp;-
Declaration
boolinDebugStatement;trueif this was in a debug statement -
Declaration
boolignoreAttributes;don't enforce attributes (e.g. call @gc function in @nogc code)
-
Declaration
this(const ref Locloc, FuncDeclarationfd, Expressionearg1);Instatiates a new function call expression
Parameters
Locloclocation
FuncDeclarationfdthe declaration of the function to call
Expressionearg1the function argument
-
Declaration
static CallExpcreate(const ref Locloc, FuncDeclarationfd, Expressionearg1);Creates a new function call expression
Parameters
Locloclocation
FuncDeclarationfdthe declaration of the function to call
Expressionearg1the function argument
-
-
Declaration
classAddrExp: dmd.expression.UnaExp;The 'address of' operator,
&p -
Declaration
classPtrExp: dmd.expression.UnaExp;The pointer dereference operator,
*p -
Declaration
classNegExp: dmd.expression.UnaExp;The negation operator,
-x -
Declaration
classUAddExp: dmd.expression.UnaExp;The unary add operator,
+x -
Declaration
classComExp: dmd.expression.UnaExp;The bitwise complement operator,
~x -
Declaration
classNotExp: dmd.expression.UnaExp;The logical not operator,
!x -
Declaration
classDeleteExp: dmd.expression.UnaExp;The delete operator,
delete x(deprecated) -
Declaration
classCastExp: dmd.expression.UnaExp;The type cast operator,
cast(T) xDiscussion
It's possible to cast to one type while painting to another type
https://dlang.org/spec/expression.html#cast_expressions -
Declaration
classVectorExp: dmd.expression.UnaExp; -
Declaration
classVectorArrayExp: dmd.expression.UnaExp;e1.array property for vectors.
Discussion
-
Declaration
classSliceExp: dmd.expression.UnaExp;e1 [lwr .. upr]
-
Declaration
this(const ref Locloc, Expressione1, IntervalExpie);
-
-
Declaration
classArrayLengthExp: dmd.expression.UnaExp;The
.lengthproperty of an array -
Declaration
classArrayExp: dmd.expression.UnaExp;e1 [ a0, a1, a2, a3 ,... ]
-
Declaration
classDotExp: dmd.expression.BinExp; -
Declaration
classCommaExp: dmd.expression.BinExp;-
Declaration
const boolisGenerated;This is needed because AssignExp rewrites CommaExp, hence it needs to trigger the deprecation.
-
Declaration
boolallowCommaExp;Temporary variable to enable / disable deprecation of comma expression depending on the context. Since most constructor calls are rewritting, the only place where
falsewill be passed will be from the parser. -
Declaration
static voidallow(Expressionexp);If the argument is a CommaExp, set a flag to prevent deprecation messages
Discussion
It's impossible to know from CommaExp.semantic if the result will be used, hence when there is a result (type != void), a deprecation message is always emitted. However, some construct can produce a result but won't use it (ExpStatement and for loop increment). Those should call this function to prevent unwanted deprecations to be emitted.
Parameters
ExpressionexpAn expression that discards its result. If the argument is
nullor not a CommaExp, nothing happens.
-
-
Declaration
classIntervalExp: dmd.expression.Expression;Mainly just a placeholder
-
Declaration
classDelegatePtrExp: dmd.expression.UnaExp;The
dg.ptrproperty, pointing to the delegate's 'context'Discussion
c.f.
DelegateFuncptrExpfor the delegate's function pointerdg.funcptr -
Declaration
classDelegateFuncptrExp: dmd.expression.UnaExp;The
dg.funcptrproperty, pointing to the delegate's functionDiscussion
c.f.
DelegatePtrExpfor the delegate's function pointerdg.ptr -
Declaration
classIndexExp: dmd.expression.BinExp;e1 [ e2 ]
-
Declaration
classPostExp: dmd.expression.BinExp;The postfix increment/decrement operator,
i++/i-- -
Declaration
classPreExp: dmd.expression.UnaExp;The prefix increment/decrement operator,
++i/--i -
Declaration
classAssignExp: dmd.expression.BinExp;The assignment / initialization operator,
=Note: operator assignment
op=has a different base class,BinAssignExp-
Declaration
this(const ref Locloc, Expressione1, Expressione2);
-
-
Declaration
classConstructExp: dmd.expression.AssignExp; -
Declaration
classBlitExp: dmd.expression.AssignExp;A bit-for-bit copy from
e2toe1 -
Declaration
classAddAssignExp: dmd.expression.BinAssignExp;x += y -
Declaration
classMinAssignExp: dmd.expression.BinAssignExp;x -= y -
Declaration
classMulAssignExp: dmd.expression.BinAssignExp;x *= y -
Declaration
classDivAssignExp: dmd.expression.BinAssignExp;x /= y -
Declaration
classModAssignExp: dmd.expression.BinAssignExp;x %= y -
Declaration
classAndAssignExp: dmd.expression.BinAssignExp;x &= y -
Declaration
classOrAssignExp: dmd.expression.BinAssignExp;x |= y -
Declaration
classXorAssignExp: dmd.expression.BinAssignExp;x ^= y -
Declaration
classPowAssignExp: dmd.expression.BinAssignExp;x ^^= y -
Declaration
classShlAssignExp: dmd.expression.BinAssignExp;x <<= y -
Declaration
classShrAssignExp: dmd.expression.BinAssignExp;x >>= y -
Declaration
classUshrAssignExp: dmd.expression.BinAssignExp;x >>>= y -
Declaration
classCatAssignExp: dmd.expression.BinAssignExp;The
~=operator.Discussion
It can have one of the following operators:
EXP.concatenateAssign - appending T[] to T[] EXP.concatenateElemAssign - appending T to T[] EXP.concatenateDcharAssign - appending dchar to T[]
The parser initially sets it to EXP.concatenateAssign, and semantic() later decides which of the three it will be set to. -
Declaration
classCatElemAssignExp: dmd.expression.CatAssignExp;The
~=operator when appending a single element -
Declaration
classCatDcharAssignExp: dmd.expression.CatAssignExp;The
~=operator when appending a singledchar -
Declaration
classAddExp: dmd.expression.BinExp;The addition operator,
x + y -
Declaration
classMinExp: dmd.expression.BinExp;The minus operator,
x - y -
Declaration
classCatExp: dmd.expression.BinExp;The concatenation operator,
x ~ y -
Declaration
classMulExp: dmd.expression.BinExp;The multiplication operator,
x * y -
Declaration
classDivExp: dmd.expression.BinExp;The division operator,
x / y -
Declaration
classModExp: dmd.expression.BinExp;The modulo operator,
x % y -
Declaration
classPowExp: dmd.expression.BinExp;The 'power' operator,
x ^^ y -
Declaration
classShlExp: dmd.expression.BinExp;The 'shift left' operator,
x << y -
Declaration
classShrExp: dmd.expression.BinExp;The 'shift right' operator,
x >> y -
Declaration
classUshrExp: dmd.expression.BinExp;The 'unsigned shift right' operator,
x >>> y -
Declaration
classAndExp: dmd.expression.BinExp;The bitwise 'and' operator,
x & y -
Declaration
classOrExp: dmd.expression.BinExp;The bitwise 'or' operator,
x | y -
Declaration
classXorExp: dmd.expression.BinExp;The bitwise 'xor' operator,
x ^ y -
Declaration
classLogicalExp: dmd.expression.BinExp;The logical 'and' / 'or' operator,
X && Y/X || Y -
Declaration
classCmpExp: dmd.expression.BinExp;A comparison operator,
<<=>>=Discussion
opis one of: EXP.lessThan, EXP.lessOrEqual, EXP.greaterThan, EXP.greaterOrEqual
https://dlang.org/spec/expression.html#relation_expressions -
Declaration
classInExp: dmd.expression.BinExp;The
inoperator,"a" in ["a": 1]Note:
x !in yis rewritten to!(x in y)in the parser
https://dlang.org/spec/expression.html#in_expressions -
Declaration
classRemoveExp: dmd.expression.BinExp;Associative array removal,
aa.remove(arg)Discussion
This deletes the key e1 from the associative array e2
-
Declaration
classEqualExp: dmd.expression.BinExp;==and!=Discussion
EXP.equal and EXP.notEqual
https://dlang.org/spec/expression.html#equality_expressions -
Declaration
classIdentityExp: dmd.expression.BinExp;isand!isDiscussion
EXP.identity and EXP.notIdentity
https://dlang.org/spec/expression.html#identity_expressions -
Declaration
classCondExp: dmd.expression.BinExp;The ternary operator,
econd ? e1 : e2 -
Declaration
pure nothrow @nogc @safe boolisDefaultInitOp(EXPop);Return Value
if this token is the
for a derivedopDefaultInitExpclass. -
Declaration
classDefaultInitExp: dmd.expression.Expression;A special keyword when used as a function's default argument
Discussion
When possible, special keywords are resolved in the parser, but when appearing as a default argument, they result in an expression deriving from this base class that is resolved for each function call.
const x = __LINE__; // resolved in the parser void foo(string file = __FILE__, int line = __LINE__); // DefaultInitExp
https://dlang.org/spec/expression.html#specialkeywords -
Declaration
classFileInitExp: dmd.expression.DefaultInitExp;The
__FILE__token as a default argument -
Declaration
classLineInitExp: dmd.expression.DefaultInitExp;The
__LINE__token as a default argument -
Declaration
classModuleInitExp: dmd.expression.DefaultInitExp;The
__MODULE__token as a default argument -
Declaration
classFuncInitExp: dmd.expression.DefaultInitExp;The
__FUNCTION__token as a default argument -
Declaration
classPrettyFuncInitExp: dmd.expression.DefaultInitExp;The
__PRETTY_FUNCTION__token as a default argument -
Declaration
classObjcClassReferenceExp: dmd.expression.Expression;Objective-C class reference expression.
Discussion
Used to get the metaclass of an Objective-C class,
NSObject.Class. -
Declaration
classGenericExp: dmd.expression.Expression;C11 6.5.1.1 Generic Selection For ImportC
-
Declaration
ExpressioncntlExp;controlling expression of a generic selection (not evaluated)
-
Declaration
Types*types;type-names for generic associations (
nullentry fordefault) -
Declaration
Expressions*exps;1:1 mapping of typeNames to
exps
-
-
Declaration
ModifiablecheckModifiable(Expressionexp, Scope*sc, ModifyFlagsflag= ModifyFlags.none);Parameters:
sc: scopeflag: 1: do not issue error message for invalid modification 2: theexpis a DotVarExp and a subfield of the leftmost variable is modifiedReturn Value
Whether the type is modifiable
-
Declaration
boolisArrayConstructionOrAssign(const Identifierid);Verify if the given identifier is any of d_array{ctor,setctor,setassign,assign_l, assign_r}.
Parameters
Identifieridthe identifier to verify
Return Value
trueif the identifier corresponds to a construction of assignement runtime hook,falseotherwise.