Mercurial > projects > ldc
annotate dmd/declaration.h @ 40:8b0e809563df trunk
[svn r44] Lots of bug fixes.
New array literal support
New array ~= operator support (for single element)
New with statement support
More...
author | lindquist |
---|---|
date | Fri, 19 Oct 2007 07:43:21 +0200 |
parents | 37a4fdab33fc |
children | 6fcc08a4d406 |
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 | |
40 | 128 virtual void toObjFile(); // compile to .obj file |
129 | |
130 bool llvmTouched; | |
1 | 131 }; |
132 | |
133 /**************************************************************/ | |
134 | |
135 struct TupleDeclaration : Declaration | |
136 { | |
137 Objects *objects; | |
138 int isexp; // 1: expression tuple | |
139 | |
140 TypeTuple *tupletype; // !=NULL if this is a type tuple | |
141 | |
142 TupleDeclaration(Loc loc, Identifier *ident, Objects *objects); | |
143 Dsymbol *syntaxCopy(Dsymbol *); | |
144 char *kind(); | |
145 Type *getType(); | |
146 int needThis(); | |
147 | |
148 TupleDeclaration *isTupleDeclaration() { return this; } | |
149 }; | |
150 | |
151 /**************************************************************/ | |
152 | |
153 struct TypedefDeclaration : Declaration | |
154 { | |
155 Type *basetype; | |
156 Initializer *init; | |
157 int sem; // 0: semantic() has not been run | |
158 // 1: semantic() is in progress | |
159 // 2: semantic() has been run | |
160 // 3: semantic2() has been run | |
161 int inuse; // used to detect typedef cycles | |
162 | |
163 TypedefDeclaration(Loc loc, Identifier *ident, Type *basetype, Initializer *init); | |
164 Dsymbol *syntaxCopy(Dsymbol *); | |
165 void semantic(Scope *sc); | |
166 void semantic2(Scope *sc); | |
167 char *mangle(); | |
168 char *kind(); | |
169 Type *getType(); | |
170 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
171 #ifdef _DH | |
172 Type *htype; | |
173 Type *hbasetype; | |
174 #endif | |
175 | |
176 void toDocBuffer(OutBuffer *buf); | |
177 | |
178 void toObjFile(); // compile to .obj file | |
179 void toDebug(); | |
180 int cvMember(unsigned char *p); | |
181 | |
182 TypedefDeclaration *isTypedefDeclaration() { return this; } | |
183 | |
184 Symbol *sinit; | |
185 Symbol *toInitializer(); | |
186 }; | |
187 | |
188 /**************************************************************/ | |
189 | |
190 struct AliasDeclaration : Declaration | |
191 { | |
192 Dsymbol *aliassym; | |
193 Dsymbol *overnext; // next in overload list | |
194 int inSemantic; | |
195 | |
196 AliasDeclaration(Loc loc, Identifier *ident, Type *type); | |
197 AliasDeclaration(Loc loc, Identifier *ident, Dsymbol *s); | |
198 Dsymbol *syntaxCopy(Dsymbol *); | |
199 void semantic(Scope *sc); | |
200 int overloadInsert(Dsymbol *s); | |
201 char *kind(); | |
202 Type *getType(); | |
203 Dsymbol *toAlias(); | |
204 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
205 #ifdef _DH | |
206 Type *htype; | |
207 Dsymbol *haliassym; | |
208 #endif | |
209 | |
210 void toDocBuffer(OutBuffer *buf); | |
211 | |
212 AliasDeclaration *isAliasDeclaration() { return this; } | |
213 }; | |
214 | |
215 /**************************************************************/ | |
216 | |
217 struct VarDeclaration : Declaration | |
218 { | |
219 Initializer *init; | |
220 unsigned offset; | |
221 int noauto; // no auto semantics | |
222 int nestedref; // referenced by a lexically nested function | |
223 int inuse; | |
224 int ctorinit; // it has been initialized in a ctor | |
225 int onstack; // 1: it has been allocated on the stack | |
226 // 2: on stack, run destructor anyway | |
227 int canassign; // it can be assigned to | |
228 Dsymbol *aliassym; // if redone as alias to another symbol | |
229 Expression *value; // when interpreting, this is the value | |
230 // (NULL if value not determinable) | |
231 | |
232 VarDeclaration(Loc loc, Type *t, Identifier *id, Initializer *init); | |
233 Dsymbol *syntaxCopy(Dsymbol *); | |
234 void semantic(Scope *sc); | |
235 void semantic2(Scope *sc); | |
236 char *kind(); | |
237 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
238 #ifdef _DH | |
239 Type *htype; | |
240 Initializer *hinit; | |
241 #endif | |
242 int needThis(); | |
243 int isImportedSymbol(); | |
244 int isDataseg(); | |
245 int hasPointers(); | |
246 Expression *callAutoDtor(); | |
247 ExpInitializer *getExpInitializer(); | |
248 void checkCtorConstInit(); | |
249 void checkNestedReference(Scope *sc, Loc loc); | |
250 Dsymbol *toAlias(); | |
251 | |
252 Symbol *toSymbol(); | |
253 void toObjFile(); // compile to .obj file | |
254 int cvMember(unsigned char *p); | |
255 | |
256 // Eliminate need for dynamic_cast | |
257 VarDeclaration *isVarDeclaration() { return (VarDeclaration *)this; } | |
258 }; | |
259 | |
260 /**************************************************************/ | |
261 | |
262 // This is a shell around a back end symbol | |
263 | |
264 struct SymbolDeclaration : Declaration | |
265 { | |
266 Symbol *sym; | |
267 StructDeclaration *dsym; | |
268 | |
269 SymbolDeclaration(Loc loc, Symbol *s, StructDeclaration *dsym); | |
270 | |
271 Symbol *toSymbol(); | |
272 | |
273 // Eliminate need for dynamic_cast | |
274 SymbolDeclaration *isSymbolDeclaration() { return (SymbolDeclaration *)this; } | |
275 }; | |
276 | |
277 struct ClassInfoDeclaration : VarDeclaration | |
278 { | |
279 ClassDeclaration *cd; | |
280 | |
281 ClassInfoDeclaration(ClassDeclaration *cd); | |
282 Dsymbol *syntaxCopy(Dsymbol *); | |
283 void semantic(Scope *sc); | |
284 | |
285 void emitComment(Scope *sc); | |
286 | |
287 Symbol *toSymbol(); | |
288 }; | |
289 | |
290 struct ModuleInfoDeclaration : VarDeclaration | |
291 { | |
292 Module *mod; | |
293 | |
294 ModuleInfoDeclaration(Module *mod); | |
295 Dsymbol *syntaxCopy(Dsymbol *); | |
296 void semantic(Scope *sc); | |
297 | |
298 void emitComment(Scope *sc); | |
299 | |
300 Symbol *toSymbol(); | |
301 }; | |
302 | |
303 struct TypeInfoDeclaration : VarDeclaration | |
304 { | |
305 Type *tinfo; | |
306 | |
307 TypeInfoDeclaration(Type *tinfo, int internal); | |
308 Dsymbol *syntaxCopy(Dsymbol *); | |
309 void semantic(Scope *sc); | |
310 | |
311 void emitComment(Scope *sc); | |
312 | |
313 Symbol *toSymbol(); | |
314 void toObjFile(); // compile to .obj file | |
315 virtual void toDt(dt_t **pdt); | |
316 | |
317 virtual TypeInfoDeclaration* isTypeInfoDeclaration() { return this; } | |
318 }; | |
319 | |
320 struct TypeInfoStructDeclaration : TypeInfoDeclaration | |
321 { | |
322 TypeInfoStructDeclaration(Type *tinfo); | |
323 | |
324 void toDt(dt_t **pdt); | |
325 }; | |
326 | |
327 struct TypeInfoClassDeclaration : TypeInfoDeclaration | |
328 { | |
329 TypeInfoClassDeclaration(Type *tinfo); | |
330 | |
331 void toDt(dt_t **pdt); | |
332 }; | |
333 | |
334 struct TypeInfoInterfaceDeclaration : TypeInfoDeclaration | |
335 { | |
336 TypeInfoInterfaceDeclaration(Type *tinfo); | |
337 | |
338 void toDt(dt_t **pdt); | |
339 }; | |
340 | |
341 struct TypeInfoTypedefDeclaration : TypeInfoDeclaration | |
342 { | |
343 TypeInfoTypedefDeclaration(Type *tinfo); | |
344 | |
345 void toDt(dt_t **pdt); | |
346 }; | |
347 | |
348 struct TypeInfoPointerDeclaration : TypeInfoDeclaration | |
349 { | |
350 TypeInfoPointerDeclaration(Type *tinfo); | |
351 | |
352 void toDt(dt_t **pdt); | |
353 }; | |
354 | |
355 struct TypeInfoArrayDeclaration : TypeInfoDeclaration | |
356 { | |
357 TypeInfoArrayDeclaration(Type *tinfo); | |
358 | |
359 void toDt(dt_t **pdt); | |
360 }; | |
361 | |
362 struct TypeInfoStaticArrayDeclaration : TypeInfoDeclaration | |
363 { | |
364 TypeInfoStaticArrayDeclaration(Type *tinfo); | |
365 | |
366 void toDt(dt_t **pdt); | |
367 }; | |
368 | |
369 struct TypeInfoAssociativeArrayDeclaration : TypeInfoDeclaration | |
370 { | |
371 TypeInfoAssociativeArrayDeclaration(Type *tinfo); | |
372 | |
373 void toDt(dt_t **pdt); | |
374 }; | |
375 | |
376 struct TypeInfoEnumDeclaration : TypeInfoDeclaration | |
377 { | |
378 TypeInfoEnumDeclaration(Type *tinfo); | |
379 | |
380 void toDt(dt_t **pdt); | |
381 }; | |
382 | |
383 struct TypeInfoFunctionDeclaration : TypeInfoDeclaration | |
384 { | |
385 TypeInfoFunctionDeclaration(Type *tinfo); | |
386 | |
387 void toDt(dt_t **pdt); | |
388 }; | |
389 | |
390 struct TypeInfoDelegateDeclaration : TypeInfoDeclaration | |
391 { | |
392 TypeInfoDelegateDeclaration(Type *tinfo); | |
393 | |
394 void toDt(dt_t **pdt); | |
395 }; | |
396 | |
397 struct TypeInfoTupleDeclaration : TypeInfoDeclaration | |
398 { | |
399 TypeInfoTupleDeclaration(Type *tinfo); | |
400 | |
401 void toDt(dt_t **pdt); | |
402 }; | |
403 | |
404 struct ThisDeclaration : VarDeclaration | |
405 { | |
406 ThisDeclaration(Type *t); | |
407 Dsymbol *syntaxCopy(Dsymbol *); | |
408 }; | |
409 | |
410 enum ILS | |
411 { | |
412 ILSuninitialized, // not computed yet | |
413 ILSno, // cannot inline | |
414 ILSyes, // can inline | |
415 }; | |
416 | |
417 /**************************************************************/ | |
418 | |
419 struct FuncDeclaration : Declaration | |
420 { | |
421 Array *fthrows; // Array of Type's of exceptions (not used) | |
422 Statement *frequire; | |
423 Statement *fensure; | |
424 Statement *fbody; | |
425 | |
426 Identifier *outId; // identifier for out statement | |
427 VarDeclaration *vresult; // variable corresponding to outId | |
428 LabelDsymbol *returnLabel; // where the return goes | |
429 | |
430 DsymbolTable *localsymtab; // used to prevent symbols in different | |
431 // scopes from having the same name | |
432 VarDeclaration *vthis; // 'this' parameter (member and nested) | |
433 VarDeclaration *v_arguments; // '_arguments' parameter | |
434 #if IN_GCC | |
435 VarDeclaration *v_argptr; // '_argptr' variable | |
436 #endif | |
437 Dsymbols *parameters; // Array of VarDeclaration's for parameters | |
438 DsymbolTable *labtab; // statement label symbol table | |
439 Declaration *overnext; // next in overload list | |
440 Loc endloc; // location of closing curly bracket | |
441 int vtblIndex; // for member functions, index into vtbl[] | |
442 int naked; // !=0 if naked | |
443 int inlineAsm; // !=0 if has inline assembler | |
444 ILS inlineStatus; | |
445 int inlineNest; // !=0 if nested inline | |
446 int cantInterpret; // !=0 if cannot interpret function | |
447 int semanticRun; // !=0 if semantic3() had been run | |
448 int nestedFrameRef; // !=0 if nested variables referenced frame ptr | |
449 ForeachStatement *fes; // if foreach body, this is the foreach | |
450 int introducing; // !=0 if 'introducing' function | |
451 Type *tintro; // if !=NULL, then this is the type | |
452 // of the 'introducing' function | |
453 // this one is overriding | |
454 int inferRetType; // !=0 if return type is to be inferred | |
455 Scope *scope; // !=NULL means context to use | |
456 | |
457 // Things that should really go into Scope | |
458 int hasReturnExp; // 1 if there's a return exp; statement | |
459 // 2 if there's a throw statement | |
460 // 4 if there's an assert(0) | |
461 // 8 if there's inline asm | |
462 | |
463 // Support for NRVO (named return value optimization) | |
464 int nrvo_can; // !=0 means we can do it | |
465 VarDeclaration *nrvo_var; // variable to replace with shidden | |
466 Symbol *shidden; // hidden pointer passed to function | |
467 | |
468 FuncDeclaration(Loc loc, Loc endloc, Identifier *id, enum STC storage_class, Type *type); | |
469 Dsymbol *syntaxCopy(Dsymbol *); | |
470 void semantic(Scope *sc); | |
471 void semantic2(Scope *sc); | |
472 void semantic3(Scope *sc); | |
473 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
474 void bodyToCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
475 int overrides(FuncDeclaration *fd); | |
476 int overloadInsert(Dsymbol *s); | |
477 FuncDeclaration *overloadExactMatch(Type *t); | |
478 FuncDeclaration *overloadResolve(Loc loc, Expressions *arguments); | |
479 LabelDsymbol *searchLabel(Identifier *ident); | |
480 AggregateDeclaration *isThis(); | |
481 AggregateDeclaration *isMember2(); | |
482 int getLevel(Loc loc, FuncDeclaration *fd); // lexical nesting level difference | |
483 void appendExp(Expression *e); | |
484 void appendState(Statement *s); | |
485 char *mangle(); | |
486 int isMain(); | |
487 int isWinMain(); | |
488 int isDllMain(); | |
489 int isExport(); | |
490 int isImportedSymbol(); | |
491 int isAbstract(); | |
492 int isCodeseg(); | |
493 virtual int isNested(); | |
494 int needThis(); | |
495 virtual int isVirtual(); | |
496 virtual int addPreInvariant(); | |
497 virtual int addPostInvariant(); | |
498 Expression *interpret(InterState *istate, Expressions *arguments); | |
499 void inlineScan(); | |
500 int canInline(int hasthis, int hdrscan = 0); | |
501 Expression *doInline(InlineScanState *iss, Expression *ethis, Array *arguments); | |
502 char *kind(); | |
503 void toDocBuffer(OutBuffer *buf); | |
504 | |
505 static FuncDeclaration *genCfunc(Type *treturn, char *name); | |
506 static FuncDeclaration *genCfunc(Type *treturn, Identifier *id); | |
507 | |
508 Symbol *toSymbol(); | |
509 Symbol *toThunkSymbol(int offset); // thunk version | |
510 void toObjFile(); // compile to .obj file | |
511 int cvMember(unsigned char *p); | |
512 | |
513 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
|
514 |
d3ee9efe20e2
[svn r15] * Fixed a bunch problems with virtual calls. Seems I did some rather poor testing.
lindquist
parents:
9
diff
changeset
|
515 bool llvmQueued; |
15
37a4fdab33fc
[svn r19] * Added support for reassigning 'this' inside class constructors.
lindquist
parents:
11
diff
changeset
|
516 llvm::Value* llvmThisVar; |
1 | 517 }; |
518 | |
519 struct FuncAliasDeclaration : FuncDeclaration | |
520 { | |
521 FuncDeclaration *funcalias; | |
522 | |
523 FuncAliasDeclaration(FuncDeclaration *funcalias); | |
524 | |
525 FuncAliasDeclaration *isFuncAliasDeclaration() { return this; } | |
526 char *kind(); | |
527 Symbol *toSymbol(); | |
528 }; | |
529 | |
530 struct FuncLiteralDeclaration : FuncDeclaration | |
531 { | |
532 enum TOK tok; // TOKfunction or TOKdelegate | |
533 | |
534 FuncLiteralDeclaration(Loc loc, Loc endloc, Type *type, enum TOK tok, | |
535 ForeachStatement *fes); | |
536 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
537 Dsymbol *syntaxCopy(Dsymbol *); | |
538 int isNested(); | |
539 | |
540 FuncLiteralDeclaration *isFuncLiteralDeclaration() { return this; } | |
541 char *kind(); | |
542 }; | |
543 | |
544 struct CtorDeclaration : FuncDeclaration | |
545 { Arguments *arguments; | |
546 int varargs; | |
547 | |
548 CtorDeclaration(Loc loc, Loc endloc, Arguments *arguments, int varargs); | |
549 Dsymbol *syntaxCopy(Dsymbol *); | |
550 void semantic(Scope *sc); | |
551 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
552 char *kind(); | |
553 char *toChars(); | |
554 int isVirtual(); | |
555 int addPreInvariant(); | |
556 int addPostInvariant(); | |
557 void toDocBuffer(OutBuffer *buf); | |
558 | |
559 CtorDeclaration *isCtorDeclaration() { return this; } | |
560 }; | |
561 | |
562 struct DtorDeclaration : FuncDeclaration | |
563 { | |
564 DtorDeclaration(Loc loc, Loc endloc); | |
565 Dsymbol *syntaxCopy(Dsymbol *); | |
566 void semantic(Scope *sc); | |
567 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
568 int isVirtual(); | |
569 int addPreInvariant(); | |
570 int addPostInvariant(); | |
571 int overloadInsert(Dsymbol *s); | |
572 void emitComment(Scope *sc); | |
573 | |
574 DtorDeclaration *isDtorDeclaration() { return this; } | |
575 }; | |
576 | |
577 struct StaticCtorDeclaration : FuncDeclaration | |
578 { | |
579 StaticCtorDeclaration(Loc loc, Loc endloc); | |
580 Dsymbol *syntaxCopy(Dsymbol *); | |
581 void semantic(Scope *sc); | |
582 AggregateDeclaration *isThis(); | |
583 int isStaticConstructor(); | |
584 int isVirtual(); | |
585 int addPreInvariant(); | |
586 int addPostInvariant(); | |
587 void emitComment(Scope *sc); | |
588 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
589 | |
590 StaticCtorDeclaration *isStaticCtorDeclaration() { return this; } | |
591 }; | |
592 | |
593 struct StaticDtorDeclaration : FuncDeclaration | |
594 { | |
595 StaticDtorDeclaration(Loc loc, Loc endloc); | |
596 Dsymbol *syntaxCopy(Dsymbol *); | |
597 void semantic(Scope *sc); | |
598 AggregateDeclaration *isThis(); | |
599 int isStaticDestructor(); | |
600 int isVirtual(); | |
601 int addPreInvariant(); | |
602 int addPostInvariant(); | |
603 void emitComment(Scope *sc); | |
604 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
605 | |
606 StaticDtorDeclaration *isStaticDtorDeclaration() { return this; } | |
607 }; | |
608 | |
609 struct InvariantDeclaration : FuncDeclaration | |
610 { | |
611 InvariantDeclaration(Loc loc, Loc endloc); | |
612 Dsymbol *syntaxCopy(Dsymbol *); | |
613 void semantic(Scope *sc); | |
614 int isVirtual(); | |
615 int addPreInvariant(); | |
616 int addPostInvariant(); | |
617 void emitComment(Scope *sc); | |
618 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
619 | |
620 InvariantDeclaration *isInvariantDeclaration() { return this; } | |
621 }; | |
622 | |
623 | |
624 struct UnitTestDeclaration : FuncDeclaration | |
625 { | |
626 UnitTestDeclaration(Loc loc, Loc endloc); | |
627 Dsymbol *syntaxCopy(Dsymbol *); | |
628 void semantic(Scope *sc); | |
629 AggregateDeclaration *isThis(); | |
630 int isVirtual(); | |
631 int addPreInvariant(); | |
632 int addPostInvariant(); | |
633 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
634 | |
635 UnitTestDeclaration *isUnitTestDeclaration() { return this; } | |
636 }; | |
637 | |
638 struct NewDeclaration : FuncDeclaration | |
639 { Arguments *arguments; | |
640 int varargs; | |
641 | |
642 NewDeclaration(Loc loc, Loc endloc, Arguments *arguments, int varargs); | |
643 Dsymbol *syntaxCopy(Dsymbol *); | |
644 void semantic(Scope *sc); | |
645 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
646 char *kind(); | |
647 int isVirtual(); | |
648 int addPreInvariant(); | |
649 int addPostInvariant(); | |
650 | |
651 NewDeclaration *isNewDeclaration() { return this; } | |
652 }; | |
653 | |
654 | |
655 struct DeleteDeclaration : FuncDeclaration | |
656 { Arguments *arguments; | |
657 | |
658 DeleteDeclaration(Loc loc, Loc endloc, Arguments *arguments); | |
659 Dsymbol *syntaxCopy(Dsymbol *); | |
660 void semantic(Scope *sc); | |
661 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
662 char *kind(); | |
663 int isDelete(); | |
664 int isVirtual(); | |
665 int addPreInvariant(); | |
666 int addPostInvariant(); | |
667 #ifdef _DH | |
668 DeleteDeclaration *isDeleteDeclaration() { return this; } | |
669 #endif | |
670 }; | |
671 | |
672 #endif /* DMD_DECLARATION_H */ |