2 /* Compiler implementation of the D programming language
3 * Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
4 * written by Walter Bright
5 * https://www.digitalmars.com
6 * Distributed under the Boost Software License, Version 1.0.
7 * https://www.boost.org/LICENSE_1_0.txt
8 * https://github.com/dlang/dmd/blob/master/src/dmd/cond.h
22 class ForeachStatement
;
23 class ForeachRangeStatement
;
27 INCLUDEnotComputed
, /// not computed yet
28 INCLUDEyes
, /// include the conditional code
29 INCLUDEno
/// do not include the conditional code
32 class Condition
: public ASTNode
38 DYNCAST
dyncast() const override final
{ return DYNCAST_CONDITION
; }
40 virtual Condition
*syntaxCopy() = 0;
41 virtual int include(Scope
*sc
) = 0;
42 virtual DebugCondition
*isDebugCondition() { return NULL
; }
43 virtual VersionCondition
*isVersionCondition() { return NULL
; }
44 void accept(Visitor
*v
) override
{ v
->visit(this); }
47 class StaticForeach final
: public RootObject
52 ForeachStatement
*aggrfe
;
53 ForeachRangeStatement
*rangefe
;
58 class DVCondition
: public Condition
65 DVCondition
*syntaxCopy() override final
;
66 void accept(Visitor
*v
) override
{ v
->visit(this); }
69 class DebugCondition final
: public DVCondition
72 static void addGlobalIdent(const char *ident
);
74 int include(Scope
*sc
) override
;
75 DebugCondition
*isDebugCondition() override
{ return this; }
76 void accept(Visitor
*v
) override
{ v
->visit(this); }
79 class VersionCondition final
: public DVCondition
82 static void addGlobalIdent(const char *ident
);
83 static void addPredefinedGlobalIdent(const char *ident
);
85 int include(Scope
*sc
) override
;
86 VersionCondition
*isVersionCondition() override
{ return this; }
87 void accept(Visitor
*v
) override
{ v
->visit(this); }
90 class StaticIfCondition final
: public Condition
95 StaticIfCondition
*syntaxCopy() override
;
96 int include(Scope
*sc
) override
;
97 void accept(Visitor
*v
) override
{ v
->visit(this); }