Mercurial > projects > ldc
annotate dmd/declaration.h @ 86:fd32135dca3e trunk
[svn r90] Major updates to the gen directory. Redesigned the 'elem' struct. Much more... !!!
Lots of bugfixes.
Added support for special foreach on strings.
Added std.array, std.utf, std.ctype and std.uni to phobos.
Changed all the .c files in the gen dir to .cpp (it *is* C++ after all)
author | lindquist |
---|---|
date | Sat, 03 Nov 2007 14:44:58 +0100 |
parents | d8dd47ef3973 |
children | 70d6113eeb8c |
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; | |
82
d8dd47ef3973
[svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
73
diff
changeset
|
265 bool llvmNeedsStorage; |
1 | 266 }; |
267 | |
268 /**************************************************************/ | |
269 | |
270 // This is a shell around a back end symbol | |
271 | |
272 struct SymbolDeclaration : Declaration | |
273 { | |
274 Symbol *sym; | |
275 StructDeclaration *dsym; | |
276 | |
277 SymbolDeclaration(Loc loc, Symbol *s, StructDeclaration *dsym); | |
278 | |
279 Symbol *toSymbol(); | |
280 | |
281 // Eliminate need for dynamic_cast | |
282 SymbolDeclaration *isSymbolDeclaration() { return (SymbolDeclaration *)this; } | |
283 }; | |
284 | |
285 struct ClassInfoDeclaration : VarDeclaration | |
286 { | |
287 ClassDeclaration *cd; | |
288 | |
289 ClassInfoDeclaration(ClassDeclaration *cd); | |
290 Dsymbol *syntaxCopy(Dsymbol *); | |
291 void semantic(Scope *sc); | |
292 | |
293 void emitComment(Scope *sc); | |
294 | |
295 Symbol *toSymbol(); | |
296 }; | |
297 | |
298 struct ModuleInfoDeclaration : VarDeclaration | |
299 { | |
300 Module *mod; | |
301 | |
302 ModuleInfoDeclaration(Module *mod); | |
303 Dsymbol *syntaxCopy(Dsymbol *); | |
304 void semantic(Scope *sc); | |
305 | |
306 void emitComment(Scope *sc); | |
307 | |
308 Symbol *toSymbol(); | |
309 }; | |
310 | |
311 struct TypeInfoDeclaration : VarDeclaration | |
312 { | |
313 Type *tinfo; | |
314 | |
315 TypeInfoDeclaration(Type *tinfo, int internal); | |
316 Dsymbol *syntaxCopy(Dsymbol *); | |
317 void semantic(Scope *sc); | |
318 | |
319 void emitComment(Scope *sc); | |
320 | |
321 Symbol *toSymbol(); | |
322 void toObjFile(); // compile to .obj file | |
323 virtual void toDt(dt_t **pdt); | |
324 | |
325 virtual TypeInfoDeclaration* isTypeInfoDeclaration() { return this; } | |
326 }; | |
327 | |
328 struct TypeInfoStructDeclaration : TypeInfoDeclaration | |
329 { | |
330 TypeInfoStructDeclaration(Type *tinfo); | |
331 | |
332 void toDt(dt_t **pdt); | |
333 }; | |
334 | |
335 struct TypeInfoClassDeclaration : TypeInfoDeclaration | |
336 { | |
337 TypeInfoClassDeclaration(Type *tinfo); | |
338 | |
339 void toDt(dt_t **pdt); | |
340 }; | |
341 | |
342 struct TypeInfoInterfaceDeclaration : TypeInfoDeclaration | |
343 { | |
344 TypeInfoInterfaceDeclaration(Type *tinfo); | |
345 | |
346 void toDt(dt_t **pdt); | |
347 }; | |
348 | |
349 struct TypeInfoTypedefDeclaration : TypeInfoDeclaration | |
350 { | |
351 TypeInfoTypedefDeclaration(Type *tinfo); | |
352 | |
353 void toDt(dt_t **pdt); | |
354 }; | |
355 | |
356 struct TypeInfoPointerDeclaration : TypeInfoDeclaration | |
357 { | |
358 TypeInfoPointerDeclaration(Type *tinfo); | |
359 | |
360 void toDt(dt_t **pdt); | |
361 }; | |
362 | |
363 struct TypeInfoArrayDeclaration : TypeInfoDeclaration | |
364 { | |
365 TypeInfoArrayDeclaration(Type *tinfo); | |
366 | |
367 void toDt(dt_t **pdt); | |
368 }; | |
369 | |
370 struct TypeInfoStaticArrayDeclaration : TypeInfoDeclaration | |
371 { | |
372 TypeInfoStaticArrayDeclaration(Type *tinfo); | |
373 | |
374 void toDt(dt_t **pdt); | |
375 }; | |
376 | |
377 struct TypeInfoAssociativeArrayDeclaration : TypeInfoDeclaration | |
378 { | |
379 TypeInfoAssociativeArrayDeclaration(Type *tinfo); | |
380 | |
381 void toDt(dt_t **pdt); | |
382 }; | |
383 | |
384 struct TypeInfoEnumDeclaration : TypeInfoDeclaration | |
385 { | |
386 TypeInfoEnumDeclaration(Type *tinfo); | |
387 | |
388 void toDt(dt_t **pdt); | |
389 }; | |
390 | |
391 struct TypeInfoFunctionDeclaration : TypeInfoDeclaration | |
392 { | |
393 TypeInfoFunctionDeclaration(Type *tinfo); | |
394 | |
395 void toDt(dt_t **pdt); | |
396 }; | |
397 | |
398 struct TypeInfoDelegateDeclaration : TypeInfoDeclaration | |
399 { | |
400 TypeInfoDelegateDeclaration(Type *tinfo); | |
401 | |
402 void toDt(dt_t **pdt); | |
403 }; | |
404 | |
405 struct TypeInfoTupleDeclaration : TypeInfoDeclaration | |
406 { | |
407 TypeInfoTupleDeclaration(Type *tinfo); | |
408 | |
409 void toDt(dt_t **pdt); | |
410 }; | |
411 | |
412 struct ThisDeclaration : VarDeclaration | |
413 { | |
414 ThisDeclaration(Type *t); | |
415 Dsymbol *syntaxCopy(Dsymbol *); | |
416 }; | |
417 | |
418 enum ILS | |
419 { | |
420 ILSuninitialized, // not computed yet | |
421 ILSno, // cannot inline | |
422 ILSyes, // can inline | |
423 }; | |
424 | |
425 /**************************************************************/ | |
426 | |
427 struct FuncDeclaration : Declaration | |
428 { | |
429 Array *fthrows; // Array of Type's of exceptions (not used) | |
430 Statement *frequire; | |
431 Statement *fensure; | |
432 Statement *fbody; | |
433 | |
434 Identifier *outId; // identifier for out statement | |
435 VarDeclaration *vresult; // variable corresponding to outId | |
436 LabelDsymbol *returnLabel; // where the return goes | |
437 | |
438 DsymbolTable *localsymtab; // used to prevent symbols in different | |
439 // scopes from having the same name | |
440 VarDeclaration *vthis; // 'this' parameter (member and nested) | |
441 VarDeclaration *v_arguments; // '_arguments' parameter | |
442 #if IN_GCC | |
443 VarDeclaration *v_argptr; // '_argptr' variable | |
444 #endif | |
445 Dsymbols *parameters; // Array of VarDeclaration's for parameters | |
446 DsymbolTable *labtab; // statement label symbol table | |
447 Declaration *overnext; // next in overload list | |
448 Loc endloc; // location of closing curly bracket | |
449 int vtblIndex; // for member functions, index into vtbl[] | |
450 int naked; // !=0 if naked | |
451 int inlineAsm; // !=0 if has inline assembler | |
452 ILS inlineStatus; | |
453 int inlineNest; // !=0 if nested inline | |
454 int cantInterpret; // !=0 if cannot interpret function | |
455 int semanticRun; // !=0 if semantic3() had been run | |
456 int nestedFrameRef; // !=0 if nested variables referenced frame ptr | |
457 ForeachStatement *fes; // if foreach body, this is the foreach | |
458 int introducing; // !=0 if 'introducing' function | |
459 Type *tintro; // if !=NULL, then this is the type | |
460 // of the 'introducing' function | |
461 // this one is overriding | |
462 int inferRetType; // !=0 if return type is to be inferred | |
463 Scope *scope; // !=NULL means context to use | |
464 | |
465 // Things that should really go into Scope | |
466 int hasReturnExp; // 1 if there's a return exp; statement | |
467 // 2 if there's a throw statement | |
468 // 4 if there's an assert(0) | |
469 // 8 if there's inline asm | |
470 | |
471 // Support for NRVO (named return value optimization) | |
472 int nrvo_can; // !=0 means we can do it | |
473 VarDeclaration *nrvo_var; // variable to replace with shidden | |
474 Symbol *shidden; // hidden pointer passed to function | |
475 | |
476 FuncDeclaration(Loc loc, Loc endloc, Identifier *id, enum STC storage_class, Type *type); | |
477 Dsymbol *syntaxCopy(Dsymbol *); | |
478 void semantic(Scope *sc); | |
479 void semantic2(Scope *sc); | |
480 void semantic3(Scope *sc); | |
481 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
482 void bodyToCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
483 int overrides(FuncDeclaration *fd); | |
484 int overloadInsert(Dsymbol *s); | |
485 FuncDeclaration *overloadExactMatch(Type *t); | |
486 FuncDeclaration *overloadResolve(Loc loc, Expressions *arguments); | |
487 LabelDsymbol *searchLabel(Identifier *ident); | |
488 AggregateDeclaration *isThis(); | |
489 AggregateDeclaration *isMember2(); | |
490 int getLevel(Loc loc, FuncDeclaration *fd); // lexical nesting level difference | |
491 void appendExp(Expression *e); | |
492 void appendState(Statement *s); | |
493 char *mangle(); | |
494 int isMain(); | |
495 int isWinMain(); | |
496 int isDllMain(); | |
497 int isExport(); | |
498 int isImportedSymbol(); | |
499 int isAbstract(); | |
500 int isCodeseg(); | |
501 virtual int isNested(); | |
502 int needThis(); | |
503 virtual int isVirtual(); | |
504 virtual int addPreInvariant(); | |
505 virtual int addPostInvariant(); | |
506 Expression *interpret(InterState *istate, Expressions *arguments); | |
507 void inlineScan(); | |
508 int canInline(int hasthis, int hdrscan = 0); | |
509 Expression *doInline(InlineScanState *iss, Expression *ethis, Array *arguments); | |
510 char *kind(); | |
511 void toDocBuffer(OutBuffer *buf); | |
512 | |
513 static FuncDeclaration *genCfunc(Type *treturn, char *name); | |
514 static FuncDeclaration *genCfunc(Type *treturn, Identifier *id); | |
515 | |
516 Symbol *toSymbol(); | |
517 Symbol *toThunkSymbol(int offset); // thunk version | |
518 void toObjFile(); // compile to .obj file | |
519 int cvMember(unsigned char *p); | |
520 | |
521 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
|
522 |
d3ee9efe20e2
[svn r15] * Fixed a bunch problems with virtual calls. Seems I did some rather poor testing.
lindquist
parents:
9
diff
changeset
|
523 bool llvmQueued; |
15
37a4fdab33fc
[svn r19] * Added support for reassigning 'this' inside class constructors.
lindquist
parents:
11
diff
changeset
|
524 llvm::Value* llvmThisVar; |
50
6fcc08a4d406
[svn r54] Added support for nested delegates referencing parent's stack variables.
lindquist
parents:
40
diff
changeset
|
525 std::set<VarDeclaration*> llvmNestedVars; |
6fcc08a4d406
[svn r54] Added support for nested delegates referencing parent's stack variables.
lindquist
parents:
40
diff
changeset
|
526 llvm::Value* llvmNested; |
57
a9d29e9f1fed
[svn r61] Added support for D-style variadic functions :)
lindquist
parents:
50
diff
changeset
|
527 llvm::Value* llvmArguments; |
a9d29e9f1fed
[svn r61] Added support for D-style variadic functions :)
lindquist
parents:
50
diff
changeset
|
528 llvm::Value* llvmArgPtr; |
82
d8dd47ef3973
[svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
73
diff
changeset
|
529 llvm::Constant* llvmDwarfSubProgram; |
86
fd32135dca3e
[svn r90] Major updates to the gen directory. Redesigned the 'elem' struct. Much more... !!!
lindquist
parents:
82
diff
changeset
|
530 bool llvmRunTimeHack; |
1 | 531 }; |
532 | |
533 struct FuncAliasDeclaration : FuncDeclaration | |
534 { | |
535 FuncDeclaration *funcalias; | |
536 | |
537 FuncAliasDeclaration(FuncDeclaration *funcalias); | |
538 | |
539 FuncAliasDeclaration *isFuncAliasDeclaration() { return this; } | |
540 char *kind(); | |
541 Symbol *toSymbol(); | |
542 }; | |
543 | |
544 struct FuncLiteralDeclaration : FuncDeclaration | |
545 { | |
546 enum TOK tok; // TOKfunction or TOKdelegate | |
547 | |
548 FuncLiteralDeclaration(Loc loc, Loc endloc, Type *type, enum TOK tok, | |
549 ForeachStatement *fes); | |
550 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
551 Dsymbol *syntaxCopy(Dsymbol *); | |
552 int isNested(); | |
553 | |
554 FuncLiteralDeclaration *isFuncLiteralDeclaration() { return this; } | |
555 char *kind(); | |
556 }; | |
557 | |
558 struct CtorDeclaration : FuncDeclaration | |
559 { Arguments *arguments; | |
560 int varargs; | |
561 | |
562 CtorDeclaration(Loc loc, Loc endloc, Arguments *arguments, int varargs); | |
563 Dsymbol *syntaxCopy(Dsymbol *); | |
564 void semantic(Scope *sc); | |
565 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
566 char *kind(); | |
567 char *toChars(); | |
568 int isVirtual(); | |
569 int addPreInvariant(); | |
570 int addPostInvariant(); | |
571 void toDocBuffer(OutBuffer *buf); | |
572 | |
573 CtorDeclaration *isCtorDeclaration() { return this; } | |
574 }; | |
575 | |
576 struct DtorDeclaration : FuncDeclaration | |
577 { | |
578 DtorDeclaration(Loc loc, Loc endloc); | |
579 Dsymbol *syntaxCopy(Dsymbol *); | |
580 void semantic(Scope *sc); | |
581 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
582 int isVirtual(); | |
583 int addPreInvariant(); | |
584 int addPostInvariant(); | |
585 int overloadInsert(Dsymbol *s); | |
586 void emitComment(Scope *sc); | |
587 | |
588 DtorDeclaration *isDtorDeclaration() { return this; } | |
589 }; | |
590 | |
591 struct StaticCtorDeclaration : FuncDeclaration | |
592 { | |
593 StaticCtorDeclaration(Loc loc, Loc endloc); | |
594 Dsymbol *syntaxCopy(Dsymbol *); | |
595 void semantic(Scope *sc); | |
596 AggregateDeclaration *isThis(); | |
597 int isStaticConstructor(); | |
598 int isVirtual(); | |
599 int addPreInvariant(); | |
600 int addPostInvariant(); | |
601 void emitComment(Scope *sc); | |
602 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
603 | |
604 StaticCtorDeclaration *isStaticCtorDeclaration() { return this; } | |
605 }; | |
606 | |
607 struct StaticDtorDeclaration : FuncDeclaration | |
608 { | |
609 StaticDtorDeclaration(Loc loc, Loc endloc); | |
610 Dsymbol *syntaxCopy(Dsymbol *); | |
611 void semantic(Scope *sc); | |
612 AggregateDeclaration *isThis(); | |
613 int isStaticDestructor(); | |
614 int isVirtual(); | |
615 int addPreInvariant(); | |
616 int addPostInvariant(); | |
617 void emitComment(Scope *sc); | |
618 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
619 | |
620 StaticDtorDeclaration *isStaticDtorDeclaration() { return this; } | |
621 }; | |
622 | |
623 struct InvariantDeclaration : FuncDeclaration | |
624 { | |
625 InvariantDeclaration(Loc loc, Loc endloc); | |
626 Dsymbol *syntaxCopy(Dsymbol *); | |
627 void semantic(Scope *sc); | |
628 int isVirtual(); | |
629 int addPreInvariant(); | |
630 int addPostInvariant(); | |
631 void emitComment(Scope *sc); | |
632 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
633 | |
634 InvariantDeclaration *isInvariantDeclaration() { return this; } | |
635 }; | |
636 | |
637 | |
638 struct UnitTestDeclaration : FuncDeclaration | |
639 { | |
640 UnitTestDeclaration(Loc loc, Loc endloc); | |
641 Dsymbol *syntaxCopy(Dsymbol *); | |
642 void semantic(Scope *sc); | |
643 AggregateDeclaration *isThis(); | |
644 int isVirtual(); | |
645 int addPreInvariant(); | |
646 int addPostInvariant(); | |
647 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
648 | |
649 UnitTestDeclaration *isUnitTestDeclaration() { return this; } | |
650 }; | |
651 | |
652 struct NewDeclaration : FuncDeclaration | |
653 { Arguments *arguments; | |
654 int varargs; | |
655 | |
656 NewDeclaration(Loc loc, Loc endloc, Arguments *arguments, int varargs); | |
657 Dsymbol *syntaxCopy(Dsymbol *); | |
658 void semantic(Scope *sc); | |
659 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
660 char *kind(); | |
661 int isVirtual(); | |
662 int addPreInvariant(); | |
663 int addPostInvariant(); | |
664 | |
665 NewDeclaration *isNewDeclaration() { return this; } | |
666 }; | |
667 | |
668 | |
669 struct DeleteDeclaration : FuncDeclaration | |
670 { Arguments *arguments; | |
671 | |
672 DeleteDeclaration(Loc loc, Loc endloc, Arguments *arguments); | |
673 Dsymbol *syntaxCopy(Dsymbol *); | |
674 void semantic(Scope *sc); | |
675 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
676 char *kind(); | |
677 int isDelete(); | |
678 int isVirtual(); | |
679 int addPreInvariant(); | |
680 int addPostInvariant(); | |
681 #ifdef _DH | |
682 DeleteDeclaration *isDeleteDeclaration() { return this; } | |
683 #endif | |
684 }; | |
685 | |
686 #endif /* DMD_DECLARATION_H */ |