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