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