0
|
1 module dmd.ConditionalStatement;
|
|
2
|
|
3 import dmd.Statement;
|
|
4 import dmd.Condition;
|
|
5 import dmd.Loc;
|
|
6 import dmd.OutBuffer;
|
|
7 import dmd.Scope;
|
|
8 import dmd.HdrGenState;
|
|
9 import dmd.ArrayTypes;
|
|
10 import dmd.BE;
|
|
11
|
|
12 class ConditionalStatement : Statement
|
|
13 {
|
|
14 Condition condition;
|
|
15 Statement ifbody;
|
|
16 Statement elsebody;
|
|
17
|
|
18 this(Loc loc, Condition condition, Statement ifbody, Statement elsebody)
|
|
19 {
|
|
20 super(loc);
|
|
21 this.condition = condition;
|
|
22 this.ifbody = ifbody;
|
|
23 this.elsebody = elsebody;
|
|
24 }
|
|
25
|
|
26 Statement syntaxCopy()
|
|
27 {
|
|
28 assert(false);
|
|
29 }
|
|
30
|
|
31 Statement semantic(Scope sc)
|
|
32 {
|
|
33 assert(false);
|
|
34 }
|
|
35
|
|
36 Statements flatten(Scope sc)
|
|
37 {
|
|
38 Statement s;
|
|
39
|
|
40 if (condition.include(sc, null))
|
|
41 s = ifbody;
|
|
42 else
|
|
43 s = elsebody;
|
|
44
|
|
45 Statements a = new Statements();
|
|
46 a.push(cast(void*)s);
|
|
47
|
|
48 return a;
|
|
49 }
|
|
50
|
|
51 bool usesEH()
|
|
52 {
|
|
53 assert(false);
|
|
54 }
|
|
55
|
|
56 BE blockExit()
|
|
57 {
|
|
58 assert(false);
|
|
59 }
|
|
60
|
|
61 void toCBuffer(OutBuffer buf, HdrGenState* hgs)
|
|
62 {
|
|
63 assert(false);
|
|
64 }
|
|
65 } |