Mercurial > projects > ldc
annotate dmd/declaration.h @ 92:70d6113eeb8c trunk
[svn r96] Updated to DMD 1.023.
Regular bugfixes.
author | lindquist |
---|---|
date | Thu, 08 Nov 2007 19:13:28 +0100 |
parents | fd32135dca3e |
children | 5071469303d4 |
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 | |
92 | 427 #if V2 |
428 | |
429 enum BUILTIN | |
430 { | |
431 BUILTINunknown = -1, // not known if this is a builtin | |
432 BUILTINnot, // this is not a builtin | |
433 BUILTINsin, // std.math.sin | |
434 BUILTINcos, // std.math.cos | |
435 BUILTINtan, // std.math.tan | |
436 BUILTINsqrt, // std.math.sqrt | |
437 BUILTINfabs, // std.math.fabs | |
438 }; | |
439 | |
440 Expression *eval_builtin(enum BUILTIN builtin, Expressions *arguments); | |
441 | |
442 #endif | |
443 | |
1 | 444 struct FuncDeclaration : Declaration |
445 { | |
446 Array *fthrows; // Array of Type's of exceptions (not used) | |
447 Statement *frequire; | |
448 Statement *fensure; | |
449 Statement *fbody; | |
450 | |
451 Identifier *outId; // identifier for out statement | |
452 VarDeclaration *vresult; // variable corresponding to outId | |
453 LabelDsymbol *returnLabel; // where the return goes | |
454 | |
455 DsymbolTable *localsymtab; // used to prevent symbols in different | |
456 // scopes from having the same name | |
457 VarDeclaration *vthis; // 'this' parameter (member and nested) | |
458 VarDeclaration *v_arguments; // '_arguments' parameter | |
459 #if IN_GCC | |
460 VarDeclaration *v_argptr; // '_argptr' variable | |
461 #endif | |
462 Dsymbols *parameters; // Array of VarDeclaration's for parameters | |
463 DsymbolTable *labtab; // statement label symbol table | |
464 Declaration *overnext; // next in overload list | |
465 Loc endloc; // location of closing curly bracket | |
466 int vtblIndex; // for member functions, index into vtbl[] | |
467 int naked; // !=0 if naked | |
468 int inlineAsm; // !=0 if has inline assembler | |
469 ILS inlineStatus; | |
470 int inlineNest; // !=0 if nested inline | |
471 int cantInterpret; // !=0 if cannot interpret function | |
472 int semanticRun; // !=0 if semantic3() had been run | |
473 ForeachStatement *fes; // if foreach body, this is the foreach | |
474 int introducing; // !=0 if 'introducing' function | |
475 Type *tintro; // if !=NULL, then this is the type | |
476 // of the 'introducing' function | |
477 // this one is overriding | |
478 int inferRetType; // !=0 if return type is to be inferred | |
479 Scope *scope; // !=NULL means context to use | |
480 | |
481 // Things that should really go into Scope | |
482 int hasReturnExp; // 1 if there's a return exp; statement | |
483 // 2 if there's a throw statement | |
484 // 4 if there's an assert(0) | |
485 // 8 if there's inline asm | |
486 | |
487 // Support for NRVO (named return value optimization) | |
488 int nrvo_can; // !=0 means we can do it | |
489 VarDeclaration *nrvo_var; // variable to replace with shidden | |
490 Symbol *shidden; // hidden pointer passed to function | |
491 | |
92 | 492 #if V2 |
493 enum BUILTIN builtin; // set if this is a known, builtin | |
494 // function we can evaluate at compile | |
495 // time | |
496 | |
497 int tookAddressOf; // set if someone took the address of | |
498 // this function | |
499 Dsymbols closureVars; // local variables in this function | |
500 // which are referenced by nested | |
501 // functions | |
502 #else | |
503 int nestedFrameRef; // !=0 if nested variables referenced | |
504 #endif | |
505 | |
1 | 506 FuncDeclaration(Loc loc, Loc endloc, Identifier *id, enum STC storage_class, Type *type); |
507 Dsymbol *syntaxCopy(Dsymbol *); | |
508 void semantic(Scope *sc); | |
509 void semantic2(Scope *sc); | |
510 void semantic3(Scope *sc); | |
511 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
512 void bodyToCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
513 int overrides(FuncDeclaration *fd); | |
514 int overloadInsert(Dsymbol *s); | |
515 FuncDeclaration *overloadExactMatch(Type *t); | |
516 FuncDeclaration *overloadResolve(Loc loc, Expressions *arguments); | |
517 LabelDsymbol *searchLabel(Identifier *ident); | |
518 AggregateDeclaration *isThis(); | |
519 AggregateDeclaration *isMember2(); | |
520 int getLevel(Loc loc, FuncDeclaration *fd); // lexical nesting level difference | |
521 void appendExp(Expression *e); | |
522 void appendState(Statement *s); | |
523 char *mangle(); | |
524 int isMain(); | |
525 int isWinMain(); | |
526 int isDllMain(); | |
527 int isExport(); | |
528 int isImportedSymbol(); | |
529 int isAbstract(); | |
530 int isCodeseg(); | |
531 virtual int isNested(); | |
532 int needThis(); | |
533 virtual int isVirtual(); | |
534 virtual int addPreInvariant(); | |
535 virtual int addPostInvariant(); | |
536 Expression *interpret(InterState *istate, Expressions *arguments); | |
537 void inlineScan(); | |
538 int canInline(int hasthis, int hdrscan = 0); | |
539 Expression *doInline(InlineScanState *iss, Expression *ethis, Array *arguments); | |
540 char *kind(); | |
541 void toDocBuffer(OutBuffer *buf); | |
542 | |
543 static FuncDeclaration *genCfunc(Type *treturn, char *name); | |
544 static FuncDeclaration *genCfunc(Type *treturn, Identifier *id); | |
545 | |
546 Symbol *toSymbol(); | |
547 Symbol *toThunkSymbol(int offset); // thunk version | |
548 void toObjFile(); // compile to .obj file | |
549 int cvMember(unsigned char *p); | |
550 | |
551 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
|
552 |
d3ee9efe20e2
[svn r15] * Fixed a bunch problems with virtual calls. Seems I did some rather poor testing.
lindquist
parents:
9
diff
changeset
|
553 bool llvmQueued; |
15
37a4fdab33fc
[svn r19] * Added support for reassigning 'this' inside class constructors.
lindquist
parents:
11
diff
changeset
|
554 llvm::Value* llvmThisVar; |
50
6fcc08a4d406
[svn r54] Added support for nested delegates referencing parent's stack variables.
lindquist
parents:
40
diff
changeset
|
555 std::set<VarDeclaration*> llvmNestedVars; |
6fcc08a4d406
[svn r54] Added support for nested delegates referencing parent's stack variables.
lindquist
parents:
40
diff
changeset
|
556 llvm::Value* llvmNested; |
57
a9d29e9f1fed
[svn r61] Added support for D-style variadic functions :)
lindquist
parents:
50
diff
changeset
|
557 llvm::Value* llvmArguments; |
a9d29e9f1fed
[svn r61] Added support for D-style variadic functions :)
lindquist
parents:
50
diff
changeset
|
558 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
|
559 llvm::Constant* llvmDwarfSubProgram; |
86
fd32135dca3e
[svn r90] Major updates to the gen directory. Redesigned the 'elem' struct. Much more... !!!
lindquist
parents:
82
diff
changeset
|
560 bool llvmRunTimeHack; |
1 | 561 }; |
562 | |
563 struct FuncAliasDeclaration : FuncDeclaration | |
564 { | |
565 FuncDeclaration *funcalias; | |
566 | |
567 FuncAliasDeclaration(FuncDeclaration *funcalias); | |
568 | |
569 FuncAliasDeclaration *isFuncAliasDeclaration() { return this; } | |
570 char *kind(); | |
571 Symbol *toSymbol(); | |
572 }; | |
573 | |
574 struct FuncLiteralDeclaration : FuncDeclaration | |
575 { | |
576 enum TOK tok; // TOKfunction or TOKdelegate | |
577 | |
578 FuncLiteralDeclaration(Loc loc, Loc endloc, Type *type, enum TOK tok, | |
579 ForeachStatement *fes); | |
580 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
581 Dsymbol *syntaxCopy(Dsymbol *); | |
582 int isNested(); | |
583 | |
584 FuncLiteralDeclaration *isFuncLiteralDeclaration() { return this; } | |
585 char *kind(); | |
586 }; | |
587 | |
588 struct CtorDeclaration : FuncDeclaration | |
589 { Arguments *arguments; | |
590 int varargs; | |
591 | |
592 CtorDeclaration(Loc loc, Loc endloc, Arguments *arguments, int varargs); | |
593 Dsymbol *syntaxCopy(Dsymbol *); | |
594 void semantic(Scope *sc); | |
595 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
596 char *kind(); | |
597 char *toChars(); | |
598 int isVirtual(); | |
599 int addPreInvariant(); | |
600 int addPostInvariant(); | |
601 void toDocBuffer(OutBuffer *buf); | |
602 | |
603 CtorDeclaration *isCtorDeclaration() { return this; } | |
604 }; | |
605 | |
606 struct DtorDeclaration : FuncDeclaration | |
607 { | |
608 DtorDeclaration(Loc loc, Loc endloc); | |
609 Dsymbol *syntaxCopy(Dsymbol *); | |
610 void semantic(Scope *sc); | |
611 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
612 int isVirtual(); | |
613 int addPreInvariant(); | |
614 int addPostInvariant(); | |
615 int overloadInsert(Dsymbol *s); | |
616 void emitComment(Scope *sc); | |
617 | |
618 DtorDeclaration *isDtorDeclaration() { return this; } | |
619 }; | |
620 | |
621 struct StaticCtorDeclaration : FuncDeclaration | |
622 { | |
623 StaticCtorDeclaration(Loc loc, Loc endloc); | |
624 Dsymbol *syntaxCopy(Dsymbol *); | |
625 void semantic(Scope *sc); | |
626 AggregateDeclaration *isThis(); | |
627 int isStaticConstructor(); | |
628 int isVirtual(); | |
629 int addPreInvariant(); | |
630 int addPostInvariant(); | |
631 void emitComment(Scope *sc); | |
632 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
633 | |
634 StaticCtorDeclaration *isStaticCtorDeclaration() { return this; } | |
635 }; | |
636 | |
637 struct StaticDtorDeclaration : FuncDeclaration | |
638 { | |
639 StaticDtorDeclaration(Loc loc, Loc endloc); | |
640 Dsymbol *syntaxCopy(Dsymbol *); | |
641 void semantic(Scope *sc); | |
642 AggregateDeclaration *isThis(); | |
643 int isStaticDestructor(); | |
644 int isVirtual(); | |
645 int addPreInvariant(); | |
646 int addPostInvariant(); | |
647 void emitComment(Scope *sc); | |
648 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
649 | |
650 StaticDtorDeclaration *isStaticDtorDeclaration() { return this; } | |
651 }; | |
652 | |
653 struct InvariantDeclaration : FuncDeclaration | |
654 { | |
655 InvariantDeclaration(Loc loc, Loc endloc); | |
656 Dsymbol *syntaxCopy(Dsymbol *); | |
657 void semantic(Scope *sc); | |
658 int isVirtual(); | |
659 int addPreInvariant(); | |
660 int addPostInvariant(); | |
661 void emitComment(Scope *sc); | |
662 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
663 | |
664 InvariantDeclaration *isInvariantDeclaration() { return this; } | |
665 }; | |
666 | |
667 | |
668 struct UnitTestDeclaration : FuncDeclaration | |
669 { | |
670 UnitTestDeclaration(Loc loc, Loc endloc); | |
671 Dsymbol *syntaxCopy(Dsymbol *); | |
672 void semantic(Scope *sc); | |
673 AggregateDeclaration *isThis(); | |
674 int isVirtual(); | |
675 int addPreInvariant(); | |
676 int addPostInvariant(); | |
677 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
678 | |
679 UnitTestDeclaration *isUnitTestDeclaration() { return this; } | |
680 }; | |
681 | |
682 struct NewDeclaration : FuncDeclaration | |
683 { Arguments *arguments; | |
684 int varargs; | |
685 | |
686 NewDeclaration(Loc loc, Loc endloc, Arguments *arguments, int varargs); | |
687 Dsymbol *syntaxCopy(Dsymbol *); | |
688 void semantic(Scope *sc); | |
689 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
690 char *kind(); | |
691 int isVirtual(); | |
692 int addPreInvariant(); | |
693 int addPostInvariant(); | |
694 | |
695 NewDeclaration *isNewDeclaration() { return this; } | |
696 }; | |
697 | |
698 | |
699 struct DeleteDeclaration : FuncDeclaration | |
700 { Arguments *arguments; | |
701 | |
702 DeleteDeclaration(Loc loc, Loc endloc, Arguments *arguments); | |
703 Dsymbol *syntaxCopy(Dsymbol *); | |
704 void semantic(Scope *sc); | |
705 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
706 char *kind(); | |
707 int isDelete(); | |
708 int isVirtual(); | |
709 int addPreInvariant(); | |
710 int addPostInvariant(); | |
711 #ifdef _DH | |
712 DeleteDeclaration *isDeleteDeclaration() { return this; } | |
713 #endif | |
714 }; | |
715 | |
716 #endif /* DMD_DECLARATION_H */ |