dmd.cond
Evaluate compile-time conditionals, such as static if
version
and debug
.
Specification: Conditional Compilation
License
Source: cond.d
Documentation: https://dlang.org/phobos/dmd_cond.html
-
Declaration
enum
Include
: ubyte;-
Declaration
notComputed
not computed yet
-
Declaration
yes
include the conditional code
-
Declaration
no
do not include the conditional code
-
-
Declaration
class
StaticForeach
: dmd.root.rootobject.RootObject;Implements common functionality for StaticForeachDeclaration and StaticForeachStatement This performs the necessary lowerings before dmd.statementsem.makeTupleForeach can be used to expand the corresponding
static foreach
declaration or statement.-
Declaration
ForeachStatement
aggrfe
;Not
null
iff thestatic foreach
is over an aggregate. In this case, it contains the corresponding ForeachStatement. For StaticForeachDeclaration, the body isnull
. -
Declaration
ForeachRangeStatement
rangefe
;Not
null
iff thestatic foreach
is over a range. Exactly one of theaggrefe
and
fields is notrangefe
null
. Seeaggrfe
field for more details. -
Declaration
bool
needExpansion
;true
if it is necessary to expand a tuple into multiple variables (see lowerNonArrayAggregate). -
Declaration
void
prepare
(Scope*sc
);Perform
static foreach
lowerings that are necessary in order to finally expand thestatic foreach
usingdmd.statementsem.makeTupleForeach
. -
Declaration
bool
ready
();Return Value
true
iffready
to calldmd.statementsem.makeTupleForeach
.
-
-
Declaration
abstract class
DVCondition
: dmd.cond.Condition; -
Declaration
class
DebugCondition
: dmd.cond.DVCondition;-
Declaration
deprecated static void
addGlobalIdent
(const(char)*ident
);
static voidaddGlobalIdent
(stringident
);
static voidaddGlobalIdent
(const(char)[]ident
);Add an user-supplied identifier to the list of global debug identifiers
Discussion
Can be called from either the driver or a
debug = Ident;
statement. Unlike version identifier, there isn't any reserved debug identifier so no validation takes place.Parameters
const(char)*
ident
identifier to add
-
Declaration
this(const ref Loc
loc
, Modulemod
, uintlevel
, Identifierident
);Instantiate a new
DebugCondition
Parameters
Module
mod
Module this node belongs to
uint
level
Minimum global
level
this condition needs to pass. Only used if
isident
null
.Identifier
ident
Identifier required for this condition to pass. If
null
, this conditiion will use an integerlevel
.Loc
loc
Location in the source file
-
-
Declaration
class
VersionCondition
: dmd.cond.DVCondition;Node to represent a version condition
Discussion
A version condition is of the form:
version (Identifier)
-
Declaration
static void
checkReserved
(const ref Locloc
, const(char)[]ident
);Raises an error if a version identifier is reserved.
Discussion
Called when setting a version identifier, e.g.
-version=identifier
parameter to the compiler orversion = Foo
in user code.Parameters
Loc
loc
Where the identifier is set
const(char)[]
ident
identifier being checked (
ident
[$] must be '\0') -
Declaration
deprecated static void
addGlobalIdent
(const(char)*ident
);
static voidaddGlobalIdent
(stringident
);
static voidaddGlobalIdent
(const(char)[]ident
);Add an user-supplied global identifier to the list
Discussion
Only called from the driver for
-version=Ident
parameters. Will raise an error if the identifier is reserved.Parameters
const(char)*
ident
identifier to add
-
Declaration
deprecated static void
addPredefinedGlobalIdent
(const(char)*ident
);
static voidaddPredefinedGlobalIdent
(stringident
);
static voidaddPredefinedGlobalIdent
(const(char)[]ident
);Add any global identifier to the list, without checking if it's predefined
Discussion
Only called from the driver after platform detection, and internally.
Parameters
const(char)*
ident
identifier to add (
ident
[$] must be '\0') -
Declaration
this(const ref Loc
loc
, Modulemod
, uintlevel
, Identifierident
);Instantiate a new
VersionCondition
Parameters
Module
mod
Module this node belongs to
uint
level
Minimum global
level
this condition needs to pass. Only used if
isident
null
.Identifier
ident
Identifier required for this condition to pass. If
null
, this conditiion will use an integerlevel
.Loc
loc
Location in the source file
-
Declaration
class
StaticIfCondition
: dmd.cond.Condition; -
Declaration
pure nothrow @safe bool
findCondition
(Identifiers*ids
, Identifierident
);Find
in an array of identifiers.ident
Parameters
Identifiers*
ids
array of identifiers
Identifier
ident
identifier to search for
Return Value
true
if found