Mercurial > projects > ldc
annotate dmd/declaration.h @ 11:d3ee9efe20e2 trunk
[svn r15] * Fixed a bunch problems with virtual calls. Seems I did some rather poor testing.
* Now 50/51 tests compile.
* Added a simple runalltests.d scripts that should be run with 'gdmd -run runalltests.d' - LLVMDC will not compile it yet.
author | lindquist |
---|---|
date | Tue, 02 Oct 2007 05:10:18 +0200 |
parents | dafae18f9c08 |
children | 37a4fdab33fc |
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_DECLARATION_H | |
12 #define DMD_DECLARATION_H | |
13 | |
14 #ifdef __DMC__ | |
15 #pragma once | |
16 #endif /* __DMC__ */ | |
17 | |
18 #include "dsymbol.h" | |
19 #include "lexer.h" | |
20 #include "mtype.h" | |
21 | |
22 namespace llvm { | |
23 class Value; | |
24 } | |
25 | |
26 struct Expression; | |
27 struct Statement; | |
28 struct LabelDsymbol; | |
29 struct Initializer; | |
30 struct Module; | |
31 struct InlineScanState; | |
32 struct ForeachStatement; | |
33 struct FuncDeclaration; | |
34 struct ExpInitializer; | |
35 struct StructDeclaration; | |
36 struct TupleType; | |
37 struct InterState; | |
38 | |
39 enum PROT; | |
40 enum LINK; | |
41 enum TOK; | |
42 enum MATCH; | |
43 | |
44 enum STC | |
45 { | |
46 STCundefined = 0, | |
47 STCstatic = 1, | |
48 STCextern = 2, | |
49 STCconst = 4, | |
50 STCfinal = 8, | |
51 STCabstract = 0x10, | |
52 STCparameter = 0x20, | |
53 STCfield = 0x40, | |
54 STCoverride = 0x80, | |
55 STCauto = 0x100, | |
56 STCsynchronized = 0x200, | |
57 STCdeprecated = 0x400, | |
58 STCin = 0x800, // in parameter | |
59 STCout = 0x1000, // out parameter | |
60 STClazy = 0x2000, // lazy parameter | |
61 STCforeach = 0x4000, // variable for foreach loop | |
62 STCcomdat = 0x8000, // should go into COMDAT record | |
63 STCvariadic = 0x10000, // variadic function argument | |
64 STCctorinit = 0x20000, // can only be set inside constructor | |
65 STCtemplateparameter = 0x40000, // template parameter | |
66 STCscope = 0x80000, // template parameter | |
67 STCinvariant = 0x100000, | |
68 STCref = 0x200000, | |
69 }; | |
70 | |
71 struct Match | |
72 { | |
73 int count; // number of matches found | |
74 MATCH last; // match level of lastf | |
75 FuncDeclaration *lastf; // last matching function we found | |
76 FuncDeclaration *nextf; // current matching function | |
77 FuncDeclaration *anyf; // pick a func, any func, to use for error recovery | |
78 }; | |
79 | |
80 void overloadResolveX(Match *m, FuncDeclaration *f, Expressions *arguments); | |
81 int overloadApply(FuncDeclaration *fstart, | |
82 int (*fp)(void *, FuncDeclaration *), | |
83 void *param); | |
84 | |
85 /**************************************************************/ | |
86 | |
87 struct Declaration : Dsymbol | |
88 { | |
89 Type *type; | |
90 unsigned storage_class; | |
91 enum PROT protection; | |
92 enum LINK linkage; | |
93 | |
94 Declaration(Identifier *id); | |
95 void semantic(Scope *sc); | |
96 char *kind(); | |
97 unsigned size(Loc loc); | |
98 | |
99 void emitComment(Scope *sc); | |
100 void toDocBuffer(OutBuffer *buf); | |
101 | |
102 char *mangle(); | |
103 int isStatic() { return storage_class & STCstatic; } | |
104 virtual int isStaticConstructor(); | |
105 virtual int isStaticDestructor(); | |
106 virtual int isDelete(); | |
107 virtual int isDataseg(); | |
108 virtual int isCodeseg(); | |
109 int isCtorinit() { return storage_class & STCctorinit; } | |
110 int isFinal() { return storage_class & STCfinal; } | |
111 int isAbstract() { return storage_class & STCabstract; } | |
112 int isConst() { return storage_class & STCconst; } | |
113 int isAuto() { return storage_class & STCauto; } | |
114 int isScope() { return storage_class & (STCscope | STCauto); } | |
115 int isSynchronized() { return storage_class & STCsynchronized; } | |
116 int isParameter() { return storage_class & STCparameter; } | |
117 int isDeprecated() { return storage_class & STCdeprecated; } | |
118 int isOverride() { return storage_class & STCoverride; } | |
119 | |
120 int isIn() { return storage_class & STCin; } | |
121 int isOut() { return storage_class & STCout; } | |
122 int isRef() { return storage_class & STCref; } | |
123 | |
124 enum PROT prot(); | |
125 | |
126 Declaration *isDeclaration() { return this; } | |
127 | |
128 virtual void toObjFile(); // compile to .obj file | |
129 }; | |
130 | |
131 /**************************************************************/ | |
132 | |
133 struct TupleDeclaration : Declaration | |
134 { | |
135 Objects *objects; | |
136 int isexp; // 1: expression tuple | |
137 | |
138 TypeTuple *tupletype; // !=NULL if this is a type tuple | |
139 | |
140 TupleDeclaration(Loc loc, Identifier *ident, Objects *objects); | |
141 Dsymbol *syntaxCopy(Dsymbol *); | |
142 char *kind(); | |
143 Type *getType(); | |
144 int needThis(); | |
145 | |
146 TupleDeclaration *isTupleDeclaration() { return this; } | |
147 }; | |
148 | |
149 /**************************************************************/ | |
150 | |
151 struct TypedefDeclaration : Declaration | |
152 { | |
153 Type *basetype; | |
154 Initializer *init; | |
155 int sem; // 0: semantic() has not been run | |
156 // 1: semantic() is in progress | |
157 // 2: semantic() has been run | |
158 // 3: semantic2() has been run | |
159 int inuse; // used to detect typedef cycles | |
160 | |
161 TypedefDeclaration(Loc loc, Identifier *ident, Type *basetype, Initializer *init); | |
162 Dsymbol *syntaxCopy(Dsymbol *); | |
163 void semantic(Scope *sc); | |
164 void semantic2(Scope *sc); | |
165 char *mangle(); | |
166 char *kind(); | |
167 Type *getType(); | |
168 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
169 #ifdef _DH | |
170 Type *htype; | |
171 Type *hbasetype; | |
172 #endif | |
173 | |
174 void toDocBuffer(OutBuffer *buf); | |
175 | |
176 void toObjFile(); // compile to .obj file | |
177 void toDebug(); | |
178 int cvMember(unsigned char *p); | |
179 | |
180 TypedefDeclaration *isTypedefDeclaration() { return this; } | |
181 | |
182 Symbol *sinit; | |
183 Symbol *toInitializer(); | |
184 }; | |
185 | |
186 /**************************************************************/ | |
187 | |
188 struct AliasDeclaration : Declaration | |
189 { | |
190 Dsymbol *aliassym; | |
191 Dsymbol *overnext; // next in overload list | |
192 int inSemantic; | |
193 | |
194 AliasDeclaration(Loc loc, Identifier *ident, Type *type); | |
195 AliasDeclaration(Loc loc, Identifier *ident, Dsymbol *s); | |
196 Dsymbol *syntaxCopy(Dsymbol *); | |
197 void semantic(Scope *sc); | |
198 int overloadInsert(Dsymbol *s); | |
199 char *kind(); | |
200 Type *getType(); | |
201 Dsymbol *toAlias(); | |
202 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
203 #ifdef _DH | |
204 Type *htype; | |
205 Dsymbol *haliassym; | |
206 #endif | |
207 | |
208 void toDocBuffer(OutBuffer *buf); | |
209 | |
210 AliasDeclaration *isAliasDeclaration() { return this; } | |
211 }; | |
212 | |
213 /**************************************************************/ | |
214 | |
215 struct VarDeclaration : Declaration | |
216 { | |
217 Initializer *init; | |
218 unsigned offset; | |
219 int noauto; // no auto semantics | |
220 int nestedref; // referenced by a lexically nested function | |
221 int inuse; | |
222 int ctorinit; // it has been initialized in a ctor | |
223 int onstack; // 1: it has been allocated on the stack | |
224 // 2: on stack, run destructor anyway | |
225 int canassign; // it can be assigned to | |
226 Dsymbol *aliassym; // if redone as alias to another symbol | |
227 Expression *value; // when interpreting, this is the value | |
228 // (NULL if value not determinable) | |
229 | |
230 VarDeclaration(Loc loc, Type *t, Identifier *id, Initializer *init); | |
231 Dsymbol *syntaxCopy(Dsymbol *); | |
232 void semantic(Scope *sc); | |
233 void semantic2(Scope *sc); | |
234 char *kind(); | |
235 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
236 #ifdef _DH | |
237 Type *htype; | |
238 Initializer *hinit; | |
239 #endif | |
240 int needThis(); | |
241 int isImportedSymbol(); | |
242 int isDataseg(); | |
243 int hasPointers(); | |
244 Expression *callAutoDtor(); | |
245 ExpInitializer *getExpInitializer(); | |
246 void checkCtorConstInit(); | |
247 void checkNestedReference(Scope *sc, Loc loc); | |
248 Dsymbol *toAlias(); | |
249 | |
250 Symbol *toSymbol(); | |
251 void toObjFile(); // compile to .obj file | |
252 int cvMember(unsigned char *p); | |
253 | |
254 // Eliminate need for dynamic_cast | |
255 VarDeclaration *isVarDeclaration() { return (VarDeclaration *)this; } | |
256 }; | |
257 | |
258 /**************************************************************/ | |
259 | |
260 // This is a shell around a back end symbol | |
261 | |
262 struct SymbolDeclaration : Declaration | |
263 { | |
264 Symbol *sym; | |
265 StructDeclaration *dsym; | |
266 | |
267 SymbolDeclaration(Loc loc, Symbol *s, StructDeclaration *dsym); | |
268 | |
269 Symbol *toSymbol(); | |
270 | |
271 // Eliminate need for dynamic_cast | |
272 SymbolDeclaration *isSymbolDeclaration() { return (SymbolDeclaration *)this; } | |
273 }; | |
274 | |
275 struct ClassInfoDeclaration : VarDeclaration | |
276 { | |
277 ClassDeclaration *cd; | |
278 | |
279 ClassInfoDeclaration(ClassDeclaration *cd); | |
280 Dsymbol *syntaxCopy(Dsymbol *); | |
281 void semantic(Scope *sc); | |
282 | |
283 void emitComment(Scope *sc); | |
284 | |
285 Symbol *toSymbol(); | |
286 }; | |
287 | |
288 struct ModuleInfoDeclaration : VarDeclaration | |
289 { | |
290 Module *mod; | |
291 | |
292 ModuleInfoDeclaration(Module *mod); | |
293 Dsymbol *syntaxCopy(Dsymbol *); | |
294 void semantic(Scope *sc); | |
295 | |
296 void emitComment(Scope *sc); | |
297 | |
298 Symbol *toSymbol(); | |
299 }; | |
300 | |
301 struct TypeInfoDeclaration : VarDeclaration | |
302 { | |
303 Type *tinfo; | |
304 | |
305 TypeInfoDeclaration(Type *tinfo, int internal); | |
306 Dsymbol *syntaxCopy(Dsymbol *); | |
307 void semantic(Scope *sc); | |
308 | |
309 void emitComment(Scope *sc); | |
310 | |
311 Symbol *toSymbol(); | |
312 void toObjFile(); // compile to .obj file | |
313 virtual void toDt(dt_t **pdt); | |
314 | |
315 virtual TypeInfoDeclaration* isTypeInfoDeclaration() { return this; } | |
316 }; | |
317 | |
318 struct TypeInfoStructDeclaration : TypeInfoDeclaration | |
319 { | |
320 TypeInfoStructDeclaration(Type *tinfo); | |
321 | |
322 void toDt(dt_t **pdt); | |
323 }; | |
324 | |
325 struct TypeInfoClassDeclaration : TypeInfoDeclaration | |
326 { | |
327 TypeInfoClassDeclaration(Type *tinfo); | |
328 | |
329 void toDt(dt_t **pdt); | |
330 }; | |
331 | |
332 struct TypeInfoInterfaceDeclaration : TypeInfoDeclaration | |
333 { | |
334 TypeInfoInterfaceDeclaration(Type *tinfo); | |
335 | |
336 void toDt(dt_t **pdt); | |
337 }; | |
338 | |
339 struct TypeInfoTypedefDeclaration : TypeInfoDeclaration | |
340 { | |
341 TypeInfoTypedefDeclaration(Type *tinfo); | |
342 | |
343 void toDt(dt_t **pdt); | |
344 }; | |
345 | |
346 struct TypeInfoPointerDeclaration : TypeInfoDeclaration | |
347 { | |
348 TypeInfoPointerDeclaration(Type *tinfo); | |
349 | |
350 void toDt(dt_t **pdt); | |
351 }; | |
352 | |
353 struct TypeInfoArrayDeclaration : TypeInfoDeclaration | |
354 { | |
355 TypeInfoArrayDeclaration(Type *tinfo); | |
356 | |
357 void toDt(dt_t **pdt); | |
358 }; | |
359 | |
360 struct TypeInfoStaticArrayDeclaration : TypeInfoDeclaration | |
361 { | |
362 TypeInfoStaticArrayDeclaration(Type *tinfo); | |
363 | |
364 void toDt(dt_t **pdt); | |
365 }; | |
366 | |
367 struct TypeInfoAssociativeArrayDeclaration : TypeInfoDeclaration | |
368 { | |
369 TypeInfoAssociativeArrayDeclaration(Type *tinfo); | |
370 | |
371 void toDt(dt_t **pdt); | |
372 }; | |
373 | |
374 struct TypeInfoEnumDeclaration : TypeInfoDeclaration | |
375 { | |
376 TypeInfoEnumDeclaration(Type *tinfo); | |
377 | |
378 void toDt(dt_t **pdt); | |
379 }; | |
380 | |
381 struct TypeInfoFunctionDeclaration : TypeInfoDeclaration | |
382 { | |
383 TypeInfoFunctionDeclaration(Type *tinfo); | |
384 | |
385 void toDt(dt_t **pdt); | |
386 }; | |
387 | |
388 struct TypeInfoDelegateDeclaration : TypeInfoDeclaration | |
389 { | |
390 TypeInfoDelegateDeclaration(Type *tinfo); | |
391 | |
392 void toDt(dt_t **pdt); | |
393 }; | |
394 | |
395 struct TypeInfoTupleDeclaration : TypeInfoDeclaration | |
396 { | |
397 TypeInfoTupleDeclaration(Type *tinfo); | |
398 | |
399 void toDt(dt_t **pdt); | |
400 }; | |
401 | |
402 struct ThisDeclaration : VarDeclaration | |
403 { | |
404 ThisDeclaration(Type *t); | |
405 Dsymbol *syntaxCopy(Dsymbol *); | |
406 }; | |
407 | |
408 enum ILS | |
409 { | |
410 ILSuninitialized, // not computed yet | |
411 ILSno, // cannot inline | |
412 ILSyes, // can inline | |
413 }; | |
414 | |
415 /**************************************************************/ | |
416 | |
417 struct FuncDeclaration : Declaration | |
418 { | |
419 Array *fthrows; // Array of Type's of exceptions (not used) | |
420 Statement *frequire; | |
421 Statement *fensure; | |
422 Statement *fbody; | |
423 | |
424 Identifier *outId; // identifier for out statement | |
425 VarDeclaration *vresult; // variable corresponding to outId | |
426 LabelDsymbol *returnLabel; // where the return goes | |
427 | |
428 DsymbolTable *localsymtab; // used to prevent symbols in different | |
429 // scopes from having the same name | |
430 VarDeclaration *vthis; // 'this' parameter (member and nested) | |
431 VarDeclaration *v_arguments; // '_arguments' parameter | |
432 #if IN_GCC | |
433 VarDeclaration *v_argptr; // '_argptr' variable | |
434 #endif | |
435 Dsymbols *parameters; // Array of VarDeclaration's for parameters | |
436 DsymbolTable *labtab; // statement label symbol table | |
437 Declaration *overnext; // next in overload list | |
438 Loc endloc; // location of closing curly bracket | |
439 int vtblIndex; // for member functions, index into vtbl[] | |
440 int naked; // !=0 if naked | |
441 int inlineAsm; // !=0 if has inline assembler | |
442 ILS inlineStatus; | |
443 int inlineNest; // !=0 if nested inline | |
444 int cantInterpret; // !=0 if cannot interpret function | |
445 int semanticRun; // !=0 if semantic3() had been run | |
446 int nestedFrameRef; // !=0 if nested variables referenced frame ptr | |
447 ForeachStatement *fes; // if foreach body, this is the foreach | |
448 int introducing; // !=0 if 'introducing' function | |
449 Type *tintro; // if !=NULL, then this is the type | |
450 // of the 'introducing' function | |
451 // this one is overriding | |
452 int inferRetType; // !=0 if return type is to be inferred | |
453 Scope *scope; // !=NULL means context to use | |
454 | |
455 // Things that should really go into Scope | |
456 int hasReturnExp; // 1 if there's a return exp; statement | |
457 // 2 if there's a throw statement | |
458 // 4 if there's an assert(0) | |
459 // 8 if there's inline asm | |
460 | |
461 // Support for NRVO (named return value optimization) | |
462 int nrvo_can; // !=0 means we can do it | |
463 VarDeclaration *nrvo_var; // variable to replace with shidden | |
464 Symbol *shidden; // hidden pointer passed to function | |
465 | |
466 FuncDeclaration(Loc loc, Loc endloc, Identifier *id, enum STC storage_class, Type *type); | |
467 Dsymbol *syntaxCopy(Dsymbol *); | |
468 void semantic(Scope *sc); | |
469 void semantic2(Scope *sc); | |
470 void semantic3(Scope *sc); | |
471 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
472 void bodyToCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
473 int overrides(FuncDeclaration *fd); | |
474 int overloadInsert(Dsymbol *s); | |
475 FuncDeclaration *overloadExactMatch(Type *t); | |
476 FuncDeclaration *overloadResolve(Loc loc, Expressions *arguments); | |
477 LabelDsymbol *searchLabel(Identifier *ident); | |
478 AggregateDeclaration *isThis(); | |
479 AggregateDeclaration *isMember2(); | |
480 int getLevel(Loc loc, FuncDeclaration *fd); // lexical nesting level difference | |
481 void appendExp(Expression *e); | |
482 void appendState(Statement *s); | |
483 char *mangle(); | |
484 int isMain(); | |
485 int isWinMain(); | |
486 int isDllMain(); | |
487 int isExport(); | |
488 int isImportedSymbol(); | |
489 int isAbstract(); | |
490 int isCodeseg(); | |
491 virtual int isNested(); | |
492 int needThis(); | |
493 virtual int isVirtual(); | |
494 virtual int addPreInvariant(); | |
495 virtual int addPostInvariant(); | |
496 Expression *interpret(InterState *istate, Expressions *arguments); | |
497 void inlineScan(); | |
498 int canInline(int hasthis, int hdrscan = 0); | |
499 Expression *doInline(InlineScanState *iss, Expression *ethis, Array *arguments); | |
500 char *kind(); | |
501 void toDocBuffer(OutBuffer *buf); | |
502 | |
503 static FuncDeclaration *genCfunc(Type *treturn, char *name); | |
504 static FuncDeclaration *genCfunc(Type *treturn, Identifier *id); | |
505 | |
506 Symbol *toSymbol(); | |
507 Symbol *toThunkSymbol(int offset); // thunk version | |
508 void toObjFile(); // compile to .obj file | |
509 int cvMember(unsigned char *p); | |
510 | |
511 FuncDeclaration *isFuncDeclaration() { return this; } | |
11
d3ee9efe20e2
[svn r15] * Fixed a bunch problems with virtual calls. Seems I did some rather poor testing.
lindquist
parents:
9
diff
changeset
|
512 |
d3ee9efe20e2
[svn r15] * Fixed a bunch problems with virtual calls. Seems I did some rather poor testing.
lindquist
parents:
9
diff
changeset
|
513 bool llvmQueued; |
1 | 514 }; |
515 | |
516 struct FuncAliasDeclaration : FuncDeclaration | |
517 { | |
518 FuncDeclaration *funcalias; | |
519 | |
520 FuncAliasDeclaration(FuncDeclaration *funcalias); | |
521 | |
522 FuncAliasDeclaration *isFuncAliasDeclaration() { return this; } | |
523 char *kind(); | |
524 Symbol *toSymbol(); | |
525 }; | |
526 | |
527 struct FuncLiteralDeclaration : FuncDeclaration | |
528 { | |
529 enum TOK tok; // TOKfunction or TOKdelegate | |
530 | |
531 FuncLiteralDeclaration(Loc loc, Loc endloc, Type *type, enum TOK tok, | |
532 ForeachStatement *fes); | |
533 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
534 Dsymbol *syntaxCopy(Dsymbol *); | |
535 int isNested(); | |
536 | |
537 FuncLiteralDeclaration *isFuncLiteralDeclaration() { return this; } | |
538 char *kind(); | |
539 }; | |
540 | |
541 struct CtorDeclaration : FuncDeclaration | |
542 { Arguments *arguments; | |
543 int varargs; | |
544 | |
545 CtorDeclaration(Loc loc, Loc endloc, Arguments *arguments, int varargs); | |
546 Dsymbol *syntaxCopy(Dsymbol *); | |
547 void semantic(Scope *sc); | |
548 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
549 char *kind(); | |
550 char *toChars(); | |
551 int isVirtual(); | |
552 int addPreInvariant(); | |
553 int addPostInvariant(); | |
554 void toDocBuffer(OutBuffer *buf); | |
555 | |
556 CtorDeclaration *isCtorDeclaration() { return this; } | |
557 }; | |
558 | |
559 struct DtorDeclaration : FuncDeclaration | |
560 { | |
561 DtorDeclaration(Loc loc, Loc endloc); | |
562 Dsymbol *syntaxCopy(Dsymbol *); | |
563 void semantic(Scope *sc); | |
564 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
565 int isVirtual(); | |
566 int addPreInvariant(); | |
567 int addPostInvariant(); | |
568 int overloadInsert(Dsymbol *s); | |
569 void emitComment(Scope *sc); | |
570 | |
571 DtorDeclaration *isDtorDeclaration() { return this; } | |
572 }; | |
573 | |
574 struct StaticCtorDeclaration : FuncDeclaration | |
575 { | |
576 StaticCtorDeclaration(Loc loc, Loc endloc); | |
577 Dsymbol *syntaxCopy(Dsymbol *); | |
578 void semantic(Scope *sc); | |
579 AggregateDeclaration *isThis(); | |
580 int isStaticConstructor(); | |
581 int isVirtual(); | |
582 int addPreInvariant(); | |
583 int addPostInvariant(); | |
584 void emitComment(Scope *sc); | |
585 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
586 | |
587 StaticCtorDeclaration *isStaticCtorDeclaration() { return this; } | |
588 }; | |
589 | |
590 struct StaticDtorDeclaration : FuncDeclaration | |
591 { | |
592 StaticDtorDeclaration(Loc loc, Loc endloc); | |
593 Dsymbol *syntaxCopy(Dsymbol *); | |
594 void semantic(Scope *sc); | |
595 AggregateDeclaration *isThis(); | |
596 int isStaticDestructor(); | |
597 int isVirtual(); | |
598 int addPreInvariant(); | |
599 int addPostInvariant(); | |
600 void emitComment(Scope *sc); | |
601 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
602 | |
603 StaticDtorDeclaration *isStaticDtorDeclaration() { return this; } | |
604 }; | |
605 | |
606 struct InvariantDeclaration : FuncDeclaration | |
607 { | |
608 InvariantDeclaration(Loc loc, Loc endloc); | |
609 Dsymbol *syntaxCopy(Dsymbol *); | |
610 void semantic(Scope *sc); | |
611 int isVirtual(); | |
612 int addPreInvariant(); | |
613 int addPostInvariant(); | |
614 void emitComment(Scope *sc); | |
615 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
616 | |
617 InvariantDeclaration *isInvariantDeclaration() { return this; } | |
618 }; | |
619 | |
620 | |
621 struct UnitTestDeclaration : FuncDeclaration | |
622 { | |
623 UnitTestDeclaration(Loc loc, Loc endloc); | |
624 Dsymbol *syntaxCopy(Dsymbol *); | |
625 void semantic(Scope *sc); | |
626 AggregateDeclaration *isThis(); | |
627 int isVirtual(); | |
628 int addPreInvariant(); | |
629 int addPostInvariant(); | |
630 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
631 | |
632 UnitTestDeclaration *isUnitTestDeclaration() { return this; } | |
633 }; | |
634 | |
635 struct NewDeclaration : FuncDeclaration | |
636 { Arguments *arguments; | |
637 int varargs; | |
638 | |
639 NewDeclaration(Loc loc, Loc endloc, Arguments *arguments, int varargs); | |
640 Dsymbol *syntaxCopy(Dsymbol *); | |
641 void semantic(Scope *sc); | |
642 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
643 char *kind(); | |
644 int isVirtual(); | |
645 int addPreInvariant(); | |
646 int addPostInvariant(); | |
647 | |
648 NewDeclaration *isNewDeclaration() { return this; } | |
649 }; | |
650 | |
651 | |
652 struct DeleteDeclaration : FuncDeclaration | |
653 { Arguments *arguments; | |
654 | |
655 DeleteDeclaration(Loc loc, Loc endloc, Arguments *arguments); | |
656 Dsymbol *syntaxCopy(Dsymbol *); | |
657 void semantic(Scope *sc); | |
658 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
659 char *kind(); | |
660 int isDelete(); | |
661 int isVirtual(); | |
662 int addPreInvariant(); | |
663 int addPostInvariant(); | |
664 #ifdef _DH | |
665 DeleteDeclaration *isDeleteDeclaration() { return this; } | |
666 #endif | |
667 }; | |
668 | |
669 #endif /* DMD_DECLARATION_H */ |