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