Mercurial > projects > ldc
annotate dmd/statement.h @ 144:a27941d00351 trunk
[svn r149] fixed: a bunch of D-style variadics problems.
fixed: GotoDefaultStatement implemented.
fixed: some other minor bugs.
author | lindquist |
---|---|
date | Sat, 26 Jan 2008 17:13:22 +0100 |
parents | 288fe1029e1f |
children | 8f704cb9969b |
rev | line source |
---|---|
1 | 1 |
2 // Compiler implementation of the D programming language | |
3 // Copyright (c) 1999-2007 by Digital Mars | |
4 // All Rights Reserved | |
5 // written by Walter Bright | |
6 // http://www.digitalmars.com | |
7 // License for redistribution is by either the Artistic License | |
8 // in artistic.txt, or the GNU General Public License in gnu.txt. | |
9 // See the included readme.txt for details. | |
10 | |
11 #ifndef DMD_STATEMENT_H | |
12 #define DMD_STATEMENT_H | |
13 | |
14 #ifdef __DMC__ | |
15 #pragma once | |
16 #endif /* __DMC__ */ | |
17 | |
18 #include "root.h" | |
19 | |
20 #include "arraytypes.h" | |
21 #include "dsymbol.h" | |
22 #include "lexer.h" | |
23 | |
24 struct OutBuffer; | |
25 struct Scope; | |
26 struct Expression; | |
27 struct LabelDsymbol; | |
28 struct Identifier; | |
29 struct IfStatement; | |
30 struct DeclarationStatement; | |
31 struct DefaultStatement; | |
32 struct VarDeclaration; | |
33 struct Condition; | |
34 struct Module; | |
35 struct Token; | |
36 struct InlineCostState; | |
37 struct InlineDoState; | |
38 struct InlineScanState; | |
39 struct ReturnStatement; | |
40 struct CompoundStatement; | |
41 struct Argument; | |
42 struct StaticAssert; | |
43 struct AsmStatement; | |
44 struct GotoStatement; | |
45 struct ScopeStatement; | |
46 struct TryCatchStatement; | |
47 struct HdrGenState; | |
48 struct InterState; | |
108
288fe1029e1f
[svn r112] Fixed 'case 1,2,3:' style case statements.
lindquist
parents:
86
diff
changeset
|
49 struct CaseStatement; |
1 | 50 |
51 enum TOK; | |
52 | |
53 namespace llvm | |
54 { | |
86
fd32135dca3e
[svn r90] Major updates to the gen directory. Redesigned the 'elem' struct. Much more... !!!
lindquist
parents:
37
diff
changeset
|
55 class Value; |
37
77cdca8c210f
[svn r41] new'd dynamic arrays are now initialized with the element type's default initializer.
lindquist
parents:
1
diff
changeset
|
56 class BasicBlock; |
1 | 57 } |
58 | |
59 // Back end | |
60 struct IRState; | |
61 struct Blockx; | |
86
fd32135dca3e
[svn r90] Major updates to the gen directory. Redesigned the 'elem' struct. Much more... !!!
lindquist
parents:
37
diff
changeset
|
62 #if IN_LLVM |
fd32135dca3e
[svn r90] Major updates to the gen directory. Redesigned the 'elem' struct. Much more... !!!
lindquist
parents:
37
diff
changeset
|
63 struct DValue; |
fd32135dca3e
[svn r90] Major updates to the gen directory. Redesigned the 'elem' struct. Much more... !!!
lindquist
parents:
37
diff
changeset
|
64 typedef DValue elem; |
fd32135dca3e
[svn r90] Major updates to the gen directory. Redesigned the 'elem' struct. Much more... !!!
lindquist
parents:
37
diff
changeset
|
65 #endif |
fd32135dca3e
[svn r90] Major updates to the gen directory. Redesigned the 'elem' struct. Much more... !!!
lindquist
parents:
37
diff
changeset
|
66 |
1 | 67 #if IN_GCC |
68 union tree_node; typedef union tree_node block; | |
86
fd32135dca3e
[svn r90] Major updates to the gen directory. Redesigned the 'elem' struct. Much more... !!!
lindquist
parents:
37
diff
changeset
|
69 //union tree_node; typedef union tree_node elem; |
1 | 70 #else |
71 struct block; | |
86
fd32135dca3e
[svn r90] Major updates to the gen directory. Redesigned the 'elem' struct. Much more... !!!
lindquist
parents:
37
diff
changeset
|
72 //struct elem; |
1 | 73 #endif |
74 struct code; | |
75 | |
76 struct Statement : Object | |
77 { | |
78 Loc loc; | |
79 | |
80 Statement(Loc loc); | |
81 virtual Statement *syntaxCopy(); | |
82 | |
83 void print(); | |
84 char *toChars(); | |
85 | |
86 void error(const char *format, ...); | |
87 virtual void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
88 virtual TryCatchStatement *isTryCatchStatement() { return NULL; } | |
89 virtual GotoStatement *isGotoStatement() { return NULL; } | |
90 virtual AsmStatement *isAsmStatement() { return NULL; } | |
91 #ifdef _DH | |
92 int incontract; | |
93 #endif | |
94 virtual ScopeStatement *isScopeStatement() { return NULL; } | |
95 virtual Statement *semantic(Scope *sc); | |
96 Statement *semanticScope(Scope *sc, Statement *sbreak, Statement *scontinue); | |
97 virtual int hasBreak(); | |
98 virtual int hasContinue(); | |
99 virtual int usesEH(); | |
100 virtual int fallOffEnd(); | |
101 virtual int comeFrom(); | |
102 virtual void scopeCode(Statement **sentry, Statement **sexit, Statement **sfinally); | |
103 virtual Statements *flatten(Scope *sc); | |
104 virtual Expression *interpret(InterState *istate); | |
105 | |
106 virtual int inlineCost(InlineCostState *ics); | |
107 virtual Expression *doInline(InlineDoState *ids); | |
108 virtual Statement *inlineScan(InlineScanState *iss); | |
109 | |
110 // Back end | |
111 virtual void toIR(IRState *irs); | |
112 | |
113 // Avoid dynamic_cast | |
114 virtual DeclarationStatement *isDeclarationStatement() { return NULL; } | |
115 virtual CompoundStatement *isCompoundStatement() { return NULL; } | |
116 virtual ReturnStatement *isReturnStatement() { return NULL; } | |
117 virtual IfStatement *isIfStatement() { return NULL; } | |
108
288fe1029e1f
[svn r112] Fixed 'case 1,2,3:' style case statements.
lindquist
parents:
86
diff
changeset
|
118 virtual CaseStatement* isCaseStatement() { return NULL; } |
1 | 119 }; |
120 | |
121 struct ExpStatement : Statement | |
122 { | |
123 Expression *exp; | |
124 | |
125 ExpStatement(Loc loc, Expression *exp); | |
126 Statement *syntaxCopy(); | |
127 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
128 Statement *semantic(Scope *sc); | |
129 Expression *interpret(InterState *istate); | |
130 int fallOffEnd(); | |
131 | |
132 int inlineCost(InlineCostState *ics); | |
133 Expression *doInline(InlineDoState *ids); | |
134 Statement *inlineScan(InlineScanState *iss); | |
135 | |
136 void toIR(IRState *irs); | |
137 }; | |
138 | |
139 struct CompileStatement : Statement | |
140 { | |
141 Expression *exp; | |
142 | |
143 CompileStatement(Loc loc, Expression *exp); | |
144 Statement *syntaxCopy(); | |
145 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
146 Statement *semantic(Scope *sc); | |
147 }; | |
148 | |
149 struct DeclarationStatement : ExpStatement | |
150 { | |
151 // Doing declarations as an expression, rather than a statement, | |
152 // makes inlining functions much easier. | |
153 | |
154 DeclarationStatement(Loc loc, Dsymbol *s); | |
155 DeclarationStatement(Loc loc, Expression *exp); | |
156 Statement *syntaxCopy(); | |
157 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
158 void scopeCode(Statement **sentry, Statement **sexit, Statement **sfinally); | |
159 | |
160 DeclarationStatement *isDeclarationStatement() { return this; } | |
161 }; | |
162 | |
163 struct CompoundStatement : Statement | |
164 { | |
165 Statements *statements; | |
166 | |
167 CompoundStatement(Loc loc, Statements *s); | |
168 CompoundStatement(Loc loc, Statement *s1, Statement *s2); | |
169 Statement *syntaxCopy(); | |
170 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
171 Statement *semantic(Scope *sc); | |
172 int usesEH(); | |
173 int fallOffEnd(); | |
174 int comeFrom(); | |
175 Statements *flatten(Scope *sc); | |
176 ReturnStatement *isReturnStatement(); | |
177 Expression *interpret(InterState *istate); | |
178 | |
179 int inlineCost(InlineCostState *ics); | |
180 Expression *doInline(InlineDoState *ids); | |
181 Statement *inlineScan(InlineScanState *iss); | |
182 | |
183 void toIR(IRState *irs); | |
184 | |
185 CompoundStatement *isCompoundStatement() { return this; } | |
186 }; | |
187 | |
188 /* The purpose of this is so that continue will go to the next | |
189 * of the statements, and break will go to the end of the statements. | |
190 */ | |
191 struct UnrolledLoopStatement : Statement | |
192 { | |
193 Statements *statements; | |
194 | |
195 UnrolledLoopStatement(Loc loc, Statements *statements); | |
196 Statement *syntaxCopy(); | |
197 Statement *semantic(Scope *sc); | |
198 int hasBreak(); | |
199 int hasContinue(); | |
200 int usesEH(); | |
201 int fallOffEnd(); | |
202 int comeFrom(); | |
203 Expression *interpret(InterState *istate); | |
204 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
205 | |
206 int inlineCost(InlineCostState *ics); | |
207 Expression *doInline(InlineDoState *ids); | |
208 Statement *inlineScan(InlineScanState *iss); | |
209 | |
210 void toIR(IRState *irs); | |
211 }; | |
212 | |
213 struct ScopeStatement : Statement | |
214 { | |
215 Statement *statement; | |
216 | |
217 ScopeStatement(Loc loc, Statement *s); | |
218 Statement *syntaxCopy(); | |
219 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
220 ScopeStatement *isScopeStatement() { return this; } | |
221 Statement *semantic(Scope *sc); | |
222 int hasBreak(); | |
223 int hasContinue(); | |
224 int usesEH(); | |
225 int fallOffEnd(); | |
226 int comeFrom(); | |
227 Expression *interpret(InterState *istate); | |
228 | |
229 Statement *inlineScan(InlineScanState *iss); | |
230 | |
231 void toIR(IRState *irs); | |
232 }; | |
233 | |
234 struct WhileStatement : Statement | |
235 { | |
236 Expression *condition; | |
237 Statement *body; | |
238 | |
239 WhileStatement(Loc loc, Expression *c, Statement *b); | |
240 Statement *syntaxCopy(); | |
241 Statement *semantic(Scope *sc); | |
242 int hasBreak(); | |
243 int hasContinue(); | |
244 int usesEH(); | |
245 int fallOffEnd(); | |
246 int comeFrom(); | |
247 Expression *interpret(InterState *istate); | |
248 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
249 | |
250 Statement *inlineScan(InlineScanState *iss); | |
251 | |
252 void toIR(IRState *irs); | |
253 }; | |
254 | |
255 struct DoStatement : Statement | |
256 { | |
257 Statement *body; | |
258 Expression *condition; | |
259 | |
260 DoStatement(Loc loc, Statement *b, Expression *c); | |
261 Statement *syntaxCopy(); | |
262 Statement *semantic(Scope *sc); | |
263 int hasBreak(); | |
264 int hasContinue(); | |
265 int usesEH(); | |
266 int fallOffEnd(); | |
267 int comeFrom(); | |
268 Expression *interpret(InterState *istate); | |
269 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
270 | |
271 Statement *inlineScan(InlineScanState *iss); | |
272 | |
273 void toIR(IRState *irs); | |
274 }; | |
275 | |
276 struct ForStatement : Statement | |
277 { | |
278 Statement *init; | |
279 Expression *condition; | |
280 Expression *increment; | |
281 Statement *body; | |
282 | |
283 ForStatement(Loc loc, Statement *init, Expression *condition, Expression *increment, Statement *body); | |
284 Statement *syntaxCopy(); | |
285 Statement *semantic(Scope *sc); | |
286 void scopeCode(Statement **sentry, Statement **sexit, Statement **sfinally); | |
287 int hasBreak(); | |
288 int hasContinue(); | |
289 int usesEH(); | |
290 int fallOffEnd(); | |
291 int comeFrom(); | |
292 Expression *interpret(InterState *istate); | |
293 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
294 | |
295 Statement *inlineScan(InlineScanState *iss); | |
296 | |
297 void toIR(IRState *irs); | |
298 }; | |
299 | |
300 struct ForeachStatement : Statement | |
301 { | |
302 enum TOK op; // TOKforeach or TOKforeach_reverse | |
303 Arguments *arguments; // array of Argument*'s | |
304 Expression *aggr; | |
305 Statement *body; | |
306 | |
307 VarDeclaration *key; | |
308 VarDeclaration *value; | |
309 | |
310 FuncDeclaration *func; // function we're lexically in | |
311 | |
312 Array cases; // put breaks, continues, gotos and returns here | |
313 Array gotos; // forward referenced goto's go here | |
314 | |
315 ForeachStatement(Loc loc, enum TOK op, Arguments *arguments, Expression *aggr, Statement *body); | |
316 Statement *syntaxCopy(); | |
317 Statement *semantic(Scope *sc); | |
318 int hasBreak(); | |
319 int hasContinue(); | |
320 int usesEH(); | |
321 int fallOffEnd(); | |
322 int comeFrom(); | |
323 Expression *interpret(InterState *istate); | |
324 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
325 | |
326 Statement *inlineScan(InlineScanState *iss); | |
327 | |
328 void toIR(IRState *irs); | |
329 }; | |
330 | |
331 struct IfStatement : Statement | |
332 { | |
333 Argument *arg; | |
334 Expression *condition; | |
335 Statement *ifbody; | |
336 Statement *elsebody; | |
337 | |
338 VarDeclaration *match; // for MatchExpression results | |
339 | |
340 IfStatement(Loc loc, Argument *arg, Expression *condition, Statement *ifbody, Statement *elsebody); | |
341 Statement *syntaxCopy(); | |
342 Statement *semantic(Scope *sc); | |
343 Expression *interpret(InterState *istate); | |
344 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
345 int usesEH(); | |
346 int fallOffEnd(); | |
347 IfStatement *isIfStatement() { return this; } | |
348 | |
349 int inlineCost(InlineCostState *ics); | |
350 Expression *doInline(InlineDoState *ids); | |
351 Statement *inlineScan(InlineScanState *iss); | |
352 | |
353 void toIR(IRState *irs); | |
354 }; | |
355 | |
356 struct ConditionalStatement : Statement | |
357 { | |
358 Condition *condition; | |
359 Statement *ifbody; | |
360 Statement *elsebody; | |
361 | |
362 ConditionalStatement(Loc loc, Condition *condition, Statement *ifbody, Statement *elsebody); | |
363 Statement *syntaxCopy(); | |
364 Statement *semantic(Scope *sc); | |
365 Statements *flatten(Scope *sc); | |
366 int usesEH(); | |
367 | |
368 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
369 }; | |
370 | |
371 struct PragmaStatement : Statement | |
372 { | |
373 Identifier *ident; | |
374 Expressions *args; // array of Expression's | |
375 Statement *body; | |
376 | |
377 PragmaStatement(Loc loc, Identifier *ident, Expressions *args, Statement *body); | |
378 Statement *syntaxCopy(); | |
379 Statement *semantic(Scope *sc); | |
380 int usesEH(); | |
381 int fallOffEnd(); | |
382 | |
383 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
384 }; | |
385 | |
386 struct StaticAssertStatement : Statement | |
387 { | |
388 StaticAssert *sa; | |
389 | |
390 StaticAssertStatement(StaticAssert *sa); | |
391 Statement *syntaxCopy(); | |
392 Statement *semantic(Scope *sc); | |
393 | |
394 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
395 }; | |
396 | |
397 struct SwitchStatement : Statement | |
398 { | |
399 Expression *condition; | |
400 Statement *body; | |
401 DefaultStatement *sdefault; | |
402 | |
403 Array gotoCases; // array of unresolved GotoCaseStatement's | |
404 Array *cases; // array of CaseStatement's | |
405 int hasNoDefault; // !=0 if no default statement | |
406 | |
407 SwitchStatement(Loc loc, Expression *c, Statement *b); | |
408 Statement *syntaxCopy(); | |
409 Statement *semantic(Scope *sc); | |
410 int hasBreak(); | |
411 int usesEH(); | |
412 int fallOffEnd(); | |
413 Expression *interpret(InterState *istate); | |
414 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
415 | |
416 Statement *inlineScan(InlineScanState *iss); | |
417 | |
418 void toIR(IRState *irs); | |
144
a27941d00351
[svn r149] fixed: a bunch of D-style variadics problems.
lindquist
parents:
108
diff
changeset
|
419 |
a27941d00351
[svn r149] fixed: a bunch of D-style variadics problems.
lindquist
parents:
108
diff
changeset
|
420 // LLVMDC |
a27941d00351
[svn r149] fixed: a bunch of D-style variadics problems.
lindquist
parents:
108
diff
changeset
|
421 llvm::BasicBlock* defaultBB; |
1 | 422 }; |
423 | |
424 struct CaseStatement : Statement | |
425 { | |
426 Expression *exp; | |
427 Statement *statement; | |
428 int index; // which case it is (since we sort this) | |
429 block *cblock; // back end: label for the block | |
430 | |
431 CaseStatement(Loc loc, Expression *exp, Statement *s); | |
432 Statement *syntaxCopy(); | |
433 Statement *semantic(Scope *sc); | |
434 int compare(Object *obj); | |
435 int usesEH(); | |
436 int fallOffEnd(); | |
437 int comeFrom(); | |
438 Expression *interpret(InterState *istate); | |
439 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
440 | |
441 Statement *inlineScan(InlineScanState *iss); | |
442 | |
443 void toIR(IRState *irs); | |
108
288fe1029e1f
[svn r112] Fixed 'case 1,2,3:' style case statements.
lindquist
parents:
86
diff
changeset
|
444 |
288fe1029e1f
[svn r112] Fixed 'case 1,2,3:' style case statements.
lindquist
parents:
86
diff
changeset
|
445 CaseStatement* isCaseStatement() { return this; } |
1 | 446 }; |
447 | |
448 struct DefaultStatement : Statement | |
449 { | |
450 Statement *statement; | |
451 #if IN_GCC | |
452 block *cblock; // back end: label for the block | |
453 #endif | |
454 | |
455 DefaultStatement(Loc loc, Statement *s); | |
456 Statement *syntaxCopy(); | |
457 Statement *semantic(Scope *sc); | |
458 int usesEH(); | |
459 int fallOffEnd(); | |
460 int comeFrom(); | |
461 Expression *interpret(InterState *istate); | |
462 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
463 | |
464 Statement *inlineScan(InlineScanState *iss); | |
465 | |
466 void toIR(IRState *irs); | |
467 }; | |
468 | |
469 struct GotoDefaultStatement : Statement | |
470 { | |
471 SwitchStatement *sw; | |
472 | |
473 GotoDefaultStatement(Loc loc); | |
474 Statement *syntaxCopy(); | |
475 Statement *semantic(Scope *sc); | |
476 Expression *interpret(InterState *istate); | |
477 int fallOffEnd(); | |
478 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
479 | |
480 void toIR(IRState *irs); | |
481 }; | |
482 | |
483 struct GotoCaseStatement : Statement | |
484 { | |
485 Expression *exp; // NULL, or which case to goto | |
486 CaseStatement *cs; // case statement it resolves to | |
487 | |
488 GotoCaseStatement(Loc loc, Expression *exp); | |
489 Statement *syntaxCopy(); | |
490 Statement *semantic(Scope *sc); | |
491 Expression *interpret(InterState *istate); | |
492 int fallOffEnd(); | |
493 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
494 | |
495 void toIR(IRState *irs); | |
496 }; | |
497 | |
498 struct SwitchErrorStatement : Statement | |
499 { | |
500 SwitchErrorStatement(Loc loc); | |
501 int fallOffEnd(); | |
502 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
503 | |
504 void toIR(IRState *irs); | |
505 }; | |
506 | |
507 struct ReturnStatement : Statement | |
508 { | |
509 Expression *exp; | |
510 | |
511 ReturnStatement(Loc loc, Expression *exp); | |
512 Statement *syntaxCopy(); | |
513 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
514 Statement *semantic(Scope *sc); | |
515 int fallOffEnd(); | |
516 Expression *interpret(InterState *istate); | |
517 | |
518 int inlineCost(InlineCostState *ics); | |
519 Expression *doInline(InlineDoState *ids); | |
520 Statement *inlineScan(InlineScanState *iss); | |
521 | |
522 void toIR(IRState *irs); | |
523 | |
524 ReturnStatement *isReturnStatement() { return this; } | |
525 }; | |
526 | |
527 struct BreakStatement : Statement | |
528 { | |
529 Identifier *ident; | |
530 | |
531 BreakStatement(Loc loc, Identifier *ident); | |
532 Statement *syntaxCopy(); | |
533 Statement *semantic(Scope *sc); | |
534 Expression *interpret(InterState *istate); | |
535 int fallOffEnd(); | |
536 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
537 | |
538 void toIR(IRState *irs); | |
539 }; | |
540 | |
541 struct ContinueStatement : Statement | |
542 { | |
543 Identifier *ident; | |
544 | |
545 ContinueStatement(Loc loc, Identifier *ident); | |
546 Statement *syntaxCopy(); | |
547 Statement *semantic(Scope *sc); | |
548 Expression *interpret(InterState *istate); | |
549 int fallOffEnd(); | |
550 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
551 | |
552 void toIR(IRState *irs); | |
553 }; | |
554 | |
555 struct SynchronizedStatement : Statement | |
556 { | |
557 Expression *exp; | |
558 Statement *body; | |
559 | |
560 SynchronizedStatement(Loc loc, Expression *exp, Statement *body); | |
561 Statement *syntaxCopy(); | |
562 Statement *semantic(Scope *sc); | |
563 int hasBreak(); | |
564 int hasContinue(); | |
565 int usesEH(); | |
566 int fallOffEnd(); | |
567 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
568 | |
569 Statement *inlineScan(InlineScanState *iss); | |
570 | |
571 // Back end | |
572 elem *esync; | |
573 SynchronizedStatement(Loc loc, elem *esync, Statement *body); | |
574 void toIR(IRState *irs); | |
575 }; | |
576 | |
577 struct WithStatement : Statement | |
578 { | |
579 Expression *exp; | |
580 Statement *body; | |
581 VarDeclaration *wthis; | |
582 | |
583 WithStatement(Loc loc, Expression *exp, Statement *body); | |
584 Statement *syntaxCopy(); | |
585 Statement *semantic(Scope *sc); | |
586 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
587 int usesEH(); | |
588 int fallOffEnd(); | |
589 | |
590 Statement *inlineScan(InlineScanState *iss); | |
591 | |
592 void toIR(IRState *irs); | |
593 }; | |
594 | |
595 struct TryCatchStatement : Statement | |
596 { | |
597 Statement *body; | |
598 Array *catches; | |
599 | |
600 TryCatchStatement(Loc loc, Statement *body, Array *catches); | |
601 Statement *syntaxCopy(); | |
602 Statement *semantic(Scope *sc); | |
603 int hasBreak(); | |
604 int usesEH(); | |
605 int fallOffEnd(); | |
606 | |
607 Statement *inlineScan(InlineScanState *iss); | |
608 | |
609 void toIR(IRState *irs); | |
610 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
611 TryCatchStatement *isTryCatchStatement() { return this; } | |
612 }; | |
613 | |
614 struct Catch : Object | |
615 { | |
616 Loc loc; | |
617 Type *type; | |
618 Identifier *ident; | |
619 VarDeclaration *var; | |
620 Statement *handler; | |
621 | |
622 Catch(Loc loc, Type *t, Identifier *id, Statement *handler); | |
623 Catch *syntaxCopy(); | |
624 void semantic(Scope *sc); | |
625 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
626 }; | |
627 | |
628 struct TryFinallyStatement : Statement | |
629 { | |
630 Statement *body; | |
631 Statement *finalbody; | |
632 | |
633 TryFinallyStatement(Loc loc, Statement *body, Statement *finalbody); | |
634 Statement *syntaxCopy(); | |
635 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
636 Statement *semantic(Scope *sc); | |
637 int hasBreak(); | |
638 int hasContinue(); | |
639 int usesEH(); | |
640 int fallOffEnd(); | |
641 | |
642 Statement *inlineScan(InlineScanState *iss); | |
643 | |
644 void toIR(IRState *irs); | |
645 }; | |
646 | |
647 struct OnScopeStatement : Statement | |
648 { | |
649 TOK tok; | |
650 Statement *statement; | |
651 | |
652 OnScopeStatement(Loc loc, TOK tok, Statement *statement); | |
653 Statement *syntaxCopy(); | |
654 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
655 Statement *semantic(Scope *sc); | |
656 int usesEH(); | |
657 void scopeCode(Statement **sentry, Statement **sexit, Statement **sfinally); | |
658 | |
659 void toIR(IRState *irs); | |
660 }; | |
661 | |
662 struct ThrowStatement : Statement | |
663 { | |
664 Expression *exp; | |
665 | |
666 ThrowStatement(Loc loc, Expression *exp); | |
667 Statement *syntaxCopy(); | |
668 Statement *semantic(Scope *sc); | |
669 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
670 int fallOffEnd(); | |
671 | |
672 Statement *inlineScan(InlineScanState *iss); | |
673 | |
674 void toIR(IRState *irs); | |
675 }; | |
676 | |
677 struct VolatileStatement : Statement | |
678 { | |
679 Statement *statement; | |
680 | |
681 VolatileStatement(Loc loc, Statement *statement); | |
682 Statement *syntaxCopy(); | |
683 Statement *semantic(Scope *sc); | |
684 Statements *flatten(Scope *sc); | |
685 int fallOffEnd(); | |
686 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
687 | |
688 Statement *inlineScan(InlineScanState *iss); | |
689 | |
690 void toIR(IRState *irs); | |
691 }; | |
692 | |
693 struct GotoStatement : Statement | |
694 { | |
695 Identifier *ident; | |
696 LabelDsymbol *label; | |
697 TryFinallyStatement *tf; | |
698 | |
699 GotoStatement(Loc loc, Identifier *ident); | |
700 Statement *syntaxCopy(); | |
701 Statement *semantic(Scope *sc); | |
702 int fallOffEnd(); | |
703 Expression *interpret(InterState *istate); | |
704 | |
705 void toIR(IRState *irs); | |
706 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
707 GotoStatement *isGotoStatement() { return this; } | |
708 }; | |
709 | |
710 struct LabelStatement : Statement | |
711 { | |
712 Identifier *ident; | |
713 Statement *statement; | |
714 TryFinallyStatement *tf; | |
715 block *lblock; // back end | |
716 int isReturnLabel; | |
717 | |
718 LabelStatement(Loc loc, Identifier *ident, Statement *statement); | |
719 Statement *syntaxCopy(); | |
720 Statement *semantic(Scope *sc); | |
721 Statements *flatten(Scope *sc); | |
722 int usesEH(); | |
723 int fallOffEnd(); | |
724 int comeFrom(); | |
725 Expression *interpret(InterState *istate); | |
726 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
727 | |
728 Statement *inlineScan(InlineScanState *iss); | |
729 | |
86
fd32135dca3e
[svn r90] Major updates to the gen directory. Redesigned the 'elem' struct. Much more... !!!
lindquist
parents:
37
diff
changeset
|
730 void toIR(IRState *irs); |
fd32135dca3e
[svn r90] Major updates to the gen directory. Redesigned the 'elem' struct. Much more... !!!
lindquist
parents:
37
diff
changeset
|
731 |
37
77cdca8c210f
[svn r41] new'd dynamic arrays are now initialized with the element type's default initializer.
lindquist
parents:
1
diff
changeset
|
732 llvm::BasicBlock* llvmBB; |
1 | 733 }; |
734 | |
735 struct LabelDsymbol : Dsymbol | |
736 { | |
737 LabelStatement *statement; | |
738 #if IN_GCC | |
739 unsigned asmLabelNum; // GCC-specific | |
740 #endif | |
741 | |
742 LabelDsymbol(Identifier *ident); | |
743 LabelDsymbol *isLabel(); | |
744 }; | |
745 | |
746 struct AsmStatement : Statement | |
747 { | |
748 Token *tokens; | |
749 code *asmcode; | |
750 unsigned asmalign; // alignment of this statement | |
751 unsigned refparam; // !=0 if function parameter is referenced | |
752 unsigned naked; // !=0 if function is to be naked | |
753 unsigned regs; // mask of registers modified | |
754 | |
755 AsmStatement(Loc loc, Token *tokens); | |
756 Statement *syntaxCopy(); | |
757 Statement *semantic(Scope *sc); | |
758 int comeFrom(); | |
759 | |
760 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
761 virtual AsmStatement *isAsmStatement() { return this; } | |
762 | |
763 void toIR(IRState *irs); | |
764 }; | |
765 | |
766 #endif /* DMD_STATEMENT_H */ |