Mercurial > projects > ddmd
comparison dmd/Statement.d @ 0:10317f0c89a5
Initial commit
author | korDen |
---|---|
date | Sat, 24 Oct 2009 08:42:06 +0400 |
parents | |
children | ecf732dfe11e |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:10317f0c89a5 |
---|---|
1 module dmd.Statement; | |
2 | |
3 import dmd.TryCatchStatement; | |
4 import dmd.GotoStatement; | |
5 import dmd.AsmStatement; | |
6 import dmd.ScopeStatement; | |
7 import dmd.DeclarationStatement; | |
8 import dmd.CompoundStatement; | |
9 import dmd.ReturnStatement; | |
10 import dmd.IfStatement; | |
11 import dmd.Scope; | |
12 import dmd.Loc; | |
13 import dmd.OutBuffer; | |
14 import dmd.HdrGenState; | |
15 import dmd.ArrayTypes; | |
16 import dmd.Expression; | |
17 import dmd.InterState; | |
18 import dmd.InlineCostState; | |
19 import dmd.InlineDoState; | |
20 import dmd.InlineScanState; | |
21 import dmd.IRState; | |
22 import dmd.BE; | |
23 import dmd.Global; | |
24 import dmd.Util; | |
25 | |
26 class Statement | |
27 { | |
28 Loc loc; | |
29 | |
30 this(Loc loc) | |
31 { | |
32 this.loc = loc; | |
33 } | |
34 | |
35 Statement syntaxCopy() | |
36 { | |
37 assert(false); | |
38 } | |
39 | |
40 void print() | |
41 { | |
42 assert(false); | |
43 } | |
44 | |
45 string toChars() | |
46 { | |
47 assert(false); | |
48 } | |
49 | |
50 void error(T...)(string format, T t) | |
51 { | |
52 assert(false); | |
53 } | |
54 | |
55 void warning(T...)(string format, T t) | |
56 { | |
57 if (global.params.warnings && !global.gag) | |
58 { | |
59 writef("warning - "); | |
60 .error(loc, format, t); | |
61 } | |
62 } | |
63 | |
64 void toCBuffer(OutBuffer buf, HdrGenState* hgs) | |
65 { | |
66 assert(false); | |
67 } | |
68 | |
69 TryCatchStatement isTryCatchStatement() { return null; } | |
70 | |
71 GotoStatement isGotoStatement() { return null; } | |
72 | |
73 AsmStatement isAsmStatement() { return null; } | |
74 | |
75 version (_DH) { | |
76 int incontract; | |
77 } | |
78 ScopeStatement isScopeStatement() { return null; } | |
79 | |
80 Statement semantic(Scope sc) | |
81 { | |
82 assert(false); | |
83 } | |
84 | |
85 Statement semanticScope(Scope sc, Statement sbreak, Statement scontinue) | |
86 { | |
87 Scope scd; | |
88 Statement s; | |
89 | |
90 scd = sc.push(); | |
91 if (sbreak) | |
92 scd.sbreak = sbreak; | |
93 if (scontinue) | |
94 scd.scontinue = scontinue; | |
95 s = semantic(scd); | |
96 scd.pop(); | |
97 return s; | |
98 } | |
99 | |
100 bool hasBreak() | |
101 { | |
102 assert(false); | |
103 } | |
104 | |
105 bool hasContinue() | |
106 { | |
107 assert(false); | |
108 } | |
109 | |
110 bool usesEH() | |
111 { | |
112 assert(false); | |
113 } | |
114 | |
115 BE blockExit() | |
116 { | |
117 assert(false); | |
118 } | |
119 | |
120 // true if statement 'comes from' somewhere else, like a goto | |
121 bool comeFrom() | |
122 { | |
123 //printf("Statement::comeFrom()\n"); | |
124 return false; | |
125 } | |
126 | |
127 // Return TRUE if statement has no code in it | |
128 bool isEmpty() | |
129 { | |
130 //printf("Statement::isEmpty()\n"); | |
131 return false; | |
132 } | |
133 | |
134 /**************************************** | |
135 * If this statement has code that needs to run in a finally clause | |
136 * at the end of the current scope, return that code in the form of | |
137 * a Statement. | |
138 * Output: | |
139 * *sentry code executed upon entry to the scope | |
140 * *sexception code executed upon exit from the scope via exception | |
141 * *sfinally code executed in finally block | |
142 */ | |
143 void scopeCode(Scope sc, Statement* sentry, Statement* sexception, Statement* sfinally) | |
144 { | |
145 //printf("Statement::scopeCode()\n"); | |
146 //print(); | |
147 *sentry = null; | |
148 *sexception = null; | |
149 *sfinally = null; | |
150 } | |
151 | |
152 /********************************* | |
153 * Flatten out the scope by presenting the statement | |
154 * as an array of statements. | |
155 * Returns NULL if no flattening necessary. | |
156 */ | |
157 Statements flatten(Scope sc) | |
158 { | |
159 return null; | |
160 } | |
161 | |
162 Expression interpret(InterState* istate) | |
163 { | |
164 assert(false); | |
165 } | |
166 | |
167 int inlineCost(InlineCostState* ics) | |
168 { | |
169 return COST_MAX; // default is we can't inline it | |
170 } | |
171 | |
172 Expression doInline(InlineDoState ids) | |
173 { | |
174 assert(false); | |
175 } | |
176 | |
177 Statement inlineScan(InlineScanState* iss) | |
178 { | |
179 return this; | |
180 } | |
181 | |
182 // Back end | |
183 void toIR(IRState* irs) | |
184 { | |
185 assert(false); | |
186 } | |
187 | |
188 // Avoid dynamic_cast | |
189 DeclarationStatement isDeclarationStatement() { return null; } | |
190 CompoundStatement isCompoundStatement() { return null; } | |
191 ReturnStatement isReturnStatement() { return null; } | |
192 IfStatement isIfStatement() { return null; } | |
193 } |