Mercurial > projects > ldc
annotate dmd/declaration.h @ 31:2841234d2aea trunk
[svn r35] * Attributes on struct fields/methods now work
* Updated object.d to 1.021
* Added -novalidate command line option. this is sometimes useful when debugging as it may let you read the .ll even if it's invalid.
author | lindquist |
---|---|
date | Thu, 04 Oct 2007 16:44:07 +0200 |
parents | 37a4fdab33fc |
children | 8b0e809563df |
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; |
15
37a4fdab33fc
[svn r19] * Added support for reassigning 'this' inside class constructors.
lindquist
parents:
11
diff
changeset
|
514 llvm::Value* llvmThisVar; |
1 | 515 }; |
516 | |
517 struct FuncAliasDeclaration : FuncDeclaration | |
518 { | |
519 FuncDeclaration *funcalias; | |
520 | |
521 FuncAliasDeclaration(FuncDeclaration *funcalias); | |
522 | |
523 FuncAliasDeclaration *isFuncAliasDeclaration() { return this; } | |
524 char *kind(); | |
525 Symbol *toSymbol(); | |
526 }; | |
527 | |
528 struct FuncLiteralDeclaration : FuncDeclaration | |
529 { | |
530 enum TOK tok; // TOKfunction or TOKdelegate | |
531 | |
532 FuncLiteralDeclaration(Loc loc, Loc endloc, Type *type, enum TOK tok, | |
533 ForeachStatement *fes); | |
534 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
535 Dsymbol *syntaxCopy(Dsymbol *); | |
536 int isNested(); | |
537 | |
538 FuncLiteralDeclaration *isFuncLiteralDeclaration() { return this; } | |
539 char *kind(); | |
540 }; | |
541 | |
542 struct CtorDeclaration : FuncDeclaration | |
543 { Arguments *arguments; | |
544 int varargs; | |
545 | |
546 CtorDeclaration(Loc loc, Loc endloc, Arguments *arguments, int varargs); | |
547 Dsymbol *syntaxCopy(Dsymbol *); | |
548 void semantic(Scope *sc); | |
549 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
550 char *kind(); | |
551 char *toChars(); | |
552 int isVirtual(); | |
553 int addPreInvariant(); | |
554 int addPostInvariant(); | |
555 void toDocBuffer(OutBuffer *buf); | |
556 | |
557 CtorDeclaration *isCtorDeclaration() { return this; } | |
558 }; | |
559 | |
560 struct DtorDeclaration : FuncDeclaration | |
561 { | |
562 DtorDeclaration(Loc loc, Loc endloc); | |
563 Dsymbol *syntaxCopy(Dsymbol *); | |
564 void semantic(Scope *sc); | |
565 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
566 int isVirtual(); | |
567 int addPreInvariant(); | |
568 int addPostInvariant(); | |
569 int overloadInsert(Dsymbol *s); | |
570 void emitComment(Scope *sc); | |
571 | |
572 DtorDeclaration *isDtorDeclaration() { return this; } | |
573 }; | |
574 | |
575 struct StaticCtorDeclaration : FuncDeclaration | |
576 { | |
577 StaticCtorDeclaration(Loc loc, Loc endloc); | |
578 Dsymbol *syntaxCopy(Dsymbol *); | |
579 void semantic(Scope *sc); | |
580 AggregateDeclaration *isThis(); | |
581 int isStaticConstructor(); | |
582 int isVirtual(); | |
583 int addPreInvariant(); | |
584 int addPostInvariant(); | |
585 void emitComment(Scope *sc); | |
586 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
587 | |
588 StaticCtorDeclaration *isStaticCtorDeclaration() { return this; } | |
589 }; | |
590 | |
591 struct StaticDtorDeclaration : FuncDeclaration | |
592 { | |
593 StaticDtorDeclaration(Loc loc, Loc endloc); | |
594 Dsymbol *syntaxCopy(Dsymbol *); | |
595 void semantic(Scope *sc); | |
596 AggregateDeclaration *isThis(); | |
597 int isStaticDestructor(); | |
598 int isVirtual(); | |
599 int addPreInvariant(); | |
600 int addPostInvariant(); | |
601 void emitComment(Scope *sc); | |
602 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
603 | |
604 StaticDtorDeclaration *isStaticDtorDeclaration() { return this; } | |
605 }; | |
606 | |
607 struct InvariantDeclaration : FuncDeclaration | |
608 { | |
609 InvariantDeclaration(Loc loc, Loc endloc); | |
610 Dsymbol *syntaxCopy(Dsymbol *); | |
611 void semantic(Scope *sc); | |
612 int isVirtual(); | |
613 int addPreInvariant(); | |
614 int addPostInvariant(); | |
615 void emitComment(Scope *sc); | |
616 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
617 | |
618 InvariantDeclaration *isInvariantDeclaration() { return this; } | |
619 }; | |
620 | |
621 | |
622 struct UnitTestDeclaration : FuncDeclaration | |
623 { | |
624 UnitTestDeclaration(Loc loc, Loc endloc); | |
625 Dsymbol *syntaxCopy(Dsymbol *); | |
626 void semantic(Scope *sc); | |
627 AggregateDeclaration *isThis(); | |
628 int isVirtual(); | |
629 int addPreInvariant(); | |
630 int addPostInvariant(); | |
631 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
632 | |
633 UnitTestDeclaration *isUnitTestDeclaration() { return this; } | |
634 }; | |
635 | |
636 struct NewDeclaration : FuncDeclaration | |
637 { Arguments *arguments; | |
638 int varargs; | |
639 | |
640 NewDeclaration(Loc loc, Loc endloc, Arguments *arguments, int varargs); | |
641 Dsymbol *syntaxCopy(Dsymbol *); | |
642 void semantic(Scope *sc); | |
643 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
644 char *kind(); | |
645 int isVirtual(); | |
646 int addPreInvariant(); | |
647 int addPostInvariant(); | |
648 | |
649 NewDeclaration *isNewDeclaration() { return this; } | |
650 }; | |
651 | |
652 | |
653 struct DeleteDeclaration : FuncDeclaration | |
654 { Arguments *arguments; | |
655 | |
656 DeleteDeclaration(Loc loc, Loc endloc, Arguments *arguments); | |
657 Dsymbol *syntaxCopy(Dsymbol *); | |
658 void semantic(Scope *sc); | |
659 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
660 char *kind(); | |
661 int isDelete(); | |
662 int isVirtual(); | |
663 int addPreInvariant(); | |
664 int addPostInvariant(); | |
665 #ifdef _DH | |
666 DeleteDeclaration *isDeleteDeclaration() { return this; } | |
667 #endif | |
668 }; | |
669 | |
670 #endif /* DMD_DECLARATION_H */ |