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.cond
Evaluate compile-time conditionals, such as static if version and debug.
Specification Conditional Compilation
Authors: 
License: 
Source cond.d
Documentation https://dlang.org/phobos/dmd_cond.html
- enumInclude: ubyte;
- 
- notComputed
- not computed yet
- yes
- include the conditional code
- no
- do not include the conditional code
 
- classStaticForeach: dmd.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.- ForeachStatementaggrfe;
- Not null iff the static foreach is over an aggregate. In this case, it contains the corresponding ForeachStatement. For StaticForeachDeclaration, the body is null.
- ForeachRangeStatementrangefe;
- Not null iff the static foreach is over a range. Exactly one of the aggrefe andrangefefields is not null. See aggrfe field for more details.
- boolneedExpansion;
- true if it is necessary to expand a tuple into multiple variables (see lowerNonArrayAggregate).
- ExpressionwrapAndCall(Locloc, Statements);
- Wrap a statement into a function literal and call it.Parameters:Loc locThe source location. Statement sThe statement. Returns:AST of the expression (){s; }() with location loc.
- StatementcreateForeach(Locloc, Parameters*parameters, Statements);
- Create a foreach statement from aggrefe/rangefe with given foreach variables and bodys.Parameters:Loc locThe source location. Parameters* parametersThe foreach variables. Statement sThe foreach body. Returns:foreach (parameters; aggregate)s; or foreach (parameters; lower .. upper)s; Where aggregate/lower, upper are as for the current StaticForeach.
- TypeStructcreateTupleType(Locloc, Expressions*e, Scope*sc);
- For a static foreach with multiple loop variables, the aggregate is lowered to an array of tuples. As D does not have built-in tuples, we need a suitable tuple type. This generates a struct that serves as the tuple type. This type is only used during CTFE and hence its typeinfo will not go to the object file.Parameters:Loc locThe source location. Expressions* eThe expressions we wish to store in the tuple. Scope* scThe current scope. Returns:A struct type of the form struct Tuple { typeof(AliasSeq!(e)) tuple; }
- @safe ExpressioncreateTuple(Locloc, TypeStructtype, Expressions*e);
- Create the AST for an instantiation of a suitable tuple type.Parameters:Loc locThe source location. TypeStruct typeA Tuple type, created with createTupleType. Expressions* eThe expressions we wish to store in the tuple. Returns:An AST for the expression Tuple(e).
- boolready();
- Returns:true iff ready to call dmd.statementsem.makeTupleForeach.
 
- abstract classDVCondition: dmd.cond.Condition;
- classDebugCondition: dmd.cond.DVCondition;
- 
- deprecated static voidaddGlobalIdent(const(char)*ident);
 static voidaddGlobalIdent(stringident);
 static voidaddGlobalIdent(const(char)[]ident);
- Add an user-supplied identifier to the list of global debug identifiersCan 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)* identidentifier to add 
- @safe this(Locloc, Modulemod, Identifierident);
- Instantiate a new DebugConditionParameters:Module modModule this node belongs to Identifier identIdentifier required for this condition to pass. If null, this conditiion will use an integer level. Loc locLocation in the source file 
 
- classVersionCondition: dmd.cond.DVCondition;
- Node to represent a version conditionA version condition is of the form:version (Identifier)In user code. This class also provides means to add version identifier to the list of global (cross module) identifiers.- static voidcheckReserved(Locloc, const(char)[]ident);
- Raises an error if a version identifier is reserved.Called when setting a version identifier, e.g. -version=identifier parameter to the compiler or version = Foo in user code.Parameters:Loc locWhere the identifier is set const(char)[] identidentifier being checked (ident[$] must be '\0') 
- deprecated static voidaddGlobalIdent(const(char)*ident);
 static voidaddGlobalIdent(stringident);
 static voidaddGlobalIdent(const(char)[]ident);
- Add an user-supplied global identifier to the listOnly called from the driver for -version=Ident parameters. Will raise an error if the identifier is reserved.Parameters:const(char)* identidentifier to add 
- deprecated static voidaddPredefinedGlobalIdent(const(char)*ident);
 static voidaddPredefinedGlobalIdent(stringident);
 static voidaddPredefinedGlobalIdent(const(char)[]ident);
- Add any global identifier to the list, without checking if it's predefinedOnly called from the driver after platform detection, and internally.Parameters:const(char)* identidentifier to add (ident[$] must be '\0') 
- @safe this(Locloc, Modulemod, Identifierident);
- Instantiate a new VersionConditionParameters:Module modModule this node belongs to Identifier identIdentifier required for this condition to pass. If null, this conditiion will use an integer level. Loc locLocation in the source file 
 
- classStaticIfCondition: dmd.cond.Condition;
- pure nothrow @safe boolfindCondition(ref Identifiersids, Identifierident);
- Findidentin an array of identifiers.Parameters:Identifiers idsarray of identifiers Identifier identidentifier to search for Returns:true if found
Copyright © 1999-2025 by the D Language Foundation | Page generated by
Ddoc on Mon Mar 31 10:27:48 2025