root/trunk/src/statement.h

Revision 736, 22.0 kB (checked in by Don Clugston, 2 years ago)

3020 No description is given why function may not be nothrow

Note that this also allows memory allocation inside nothrow functions. Switch statements with missing default are still forbidden.

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