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
|
|
18 #include "dsymbol.h"
|
|
19 #include "lexer.h"
|
|
20 #include "mtype.h"
|
|
21
|
|
22 namespace llvm {
|
|
23 class Value;
|
|
24 }
|
|
25
|
|
26 struct Expression;
|
|
27 struct Statement;
|
|
28 struct LabelDsymbol;
|
|
29 struct Initializer;
|
|
30 struct Module;
|
|
31 struct InlineScanState;
|
|
32 struct ForeachStatement;
|
|
33 struct FuncDeclaration;
|
|
34 struct ExpInitializer;
|
|
35 struct StructDeclaration;
|
|
36 struct TupleType;
|
|
37 struct InterState;
|
|
38
|
|
39 enum PROT;
|
|
40 enum LINK;
|
|
41 enum TOK;
|
|
42 enum MATCH;
|
|
43
|
|
44 enum STC
|
|
45 {
|
|
46 STCundefined = 0,
|
|
47 STCstatic = 1,
|
|
48 STCextern = 2,
|
|
49 STCconst = 4,
|
|
50 STCfinal = 8,
|
|
51 STCabstract = 0x10,
|
|
52 STCparameter = 0x20,
|
|
53 STCfield = 0x40,
|
|
54 STCoverride = 0x80,
|
|
55 STCauto = 0x100,
|
|
56 STCsynchronized = 0x200,
|
|
57 STCdeprecated = 0x400,
|
|
58 STCin = 0x800, // in parameter
|
|
59 STCout = 0x1000, // out parameter
|
|
60 STClazy = 0x2000, // lazy parameter
|
|
61 STCforeach = 0x4000, // variable for foreach loop
|
|
62 STCcomdat = 0x8000, // should go into COMDAT record
|
|
63 STCvariadic = 0x10000, // variadic function argument
|
|
64 STCctorinit = 0x20000, // can only be set inside constructor
|
|
65 STCtemplateparameter = 0x40000, // template parameter
|
|
66 STCscope = 0x80000, // template parameter
|
|
67 STCinvariant = 0x100000,
|
|
68 STCref = 0x200000,
|
|
69 };
|
|
70
|
|
71 struct Match
|
|
72 {
|
|
73 int count; // number of matches found
|
|
74 MATCH last; // match level of lastf
|
|
75 FuncDeclaration *lastf; // last matching function we found
|
|
76 FuncDeclaration *nextf; // current matching function
|
|
77 FuncDeclaration *anyf; // pick a func, any func, to use for error recovery
|
|
78 };
|
|
79
|
|
80 void overloadResolveX(Match *m, FuncDeclaration *f, Expressions *arguments);
|
|
81 int overloadApply(FuncDeclaration *fstart,
|
|
82 int (*fp)(void *, FuncDeclaration *),
|
|
83 void *param);
|
|
84
|
|
85 /**************************************************************/
|
|
86
|
|
87 struct Declaration : Dsymbol
|
|
88 {
|
|
89 Type *type;
|
|
90 unsigned storage_class;
|
|
91 enum PROT protection;
|
|
92 enum LINK linkage;
|
|
93
|
|
94 Declaration(Identifier *id);
|
|
95 void semantic(Scope *sc);
|
|
96 char *kind();
|
|
97 unsigned size(Loc loc);
|
|
98
|
|
99 void emitComment(Scope *sc);
|
|
100 void toDocBuffer(OutBuffer *buf);
|
|
101
|
|
102 char *mangle();
|
|
103 int isStatic() { return storage_class & STCstatic; }
|
|
104 virtual int isStaticConstructor();
|
|
105 virtual int isStaticDestructor();
|
|
106 virtual int isDelete();
|
|
107 virtual int isDataseg();
|
|
108 virtual int isCodeseg();
|
|
109 int isCtorinit() { return storage_class & STCctorinit; }
|
|
110 int isFinal() { return storage_class & STCfinal; }
|
|
111 int isAbstract() { return storage_class & STCabstract; }
|
|
112 int isConst() { return storage_class & STCconst; }
|
|
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
|
|
128 virtual void toObjFile(); // compile to .obj file
|
|
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; }
|
|
256 };
|
|
257
|
|
258 /**************************************************************/
|
|
259
|
|
260 // This is a shell around a back end symbol
|
|
261
|
|
262 struct SymbolDeclaration : Declaration
|
|
263 {
|
|
264 Symbol *sym;
|
|
265 StructDeclaration *dsym;
|
|
266
|
|
267 SymbolDeclaration(Loc loc, Symbol *s, StructDeclaration *dsym);
|
|
268
|
|
269 Symbol *toSymbol();
|
|
270
|
|
271 // Eliminate need for dynamic_cast
|
|
272 SymbolDeclaration *isSymbolDeclaration() { return (SymbolDeclaration *)this; }
|
|
273 };
|
|
274
|
|
275 struct ClassInfoDeclaration : VarDeclaration
|
|
276 {
|
|
277 ClassDeclaration *cd;
|
|
278
|
|
279 ClassInfoDeclaration(ClassDeclaration *cd);
|
|
280 Dsymbol *syntaxCopy(Dsymbol *);
|
|
281 void semantic(Scope *sc);
|
|
282
|
|
283 void emitComment(Scope *sc);
|
|
284
|
|
285 Symbol *toSymbol();
|
|
286 };
|
|
287
|
|
288 struct ModuleInfoDeclaration : VarDeclaration
|
|
289 {
|
|
290 Module *mod;
|
|
291
|
|
292 ModuleInfoDeclaration(Module *mod);
|
|
293 Dsymbol *syntaxCopy(Dsymbol *);
|
|
294 void semantic(Scope *sc);
|
|
295
|
|
296 void emitComment(Scope *sc);
|
|
297
|
|
298 Symbol *toSymbol();
|
|
299 };
|
|
300
|
|
301 struct TypeInfoDeclaration : VarDeclaration
|
|
302 {
|
|
303 Type *tinfo;
|
|
304
|
|
305 TypeInfoDeclaration(Type *tinfo, int internal);
|
|
306 Dsymbol *syntaxCopy(Dsymbol *);
|
|
307 void semantic(Scope *sc);
|
|
308
|
|
309 void emitComment(Scope *sc);
|
|
310
|
|
311 Symbol *toSymbol();
|
|
312 void toObjFile(); // compile to .obj file
|
|
313 virtual void toDt(dt_t **pdt);
|
|
314
|
|
315 virtual TypeInfoDeclaration* isTypeInfoDeclaration() { return this; }
|
|
316 };
|
|
317
|
|
318 struct TypeInfoStructDeclaration : TypeInfoDeclaration
|
|
319 {
|
|
320 TypeInfoStructDeclaration(Type *tinfo);
|
|
321
|
|
322 void toDt(dt_t **pdt);
|
|
323 };
|
|
324
|
|
325 struct TypeInfoClassDeclaration : TypeInfoDeclaration
|
|
326 {
|
|
327 TypeInfoClassDeclaration(Type *tinfo);
|
|
328
|
|
329 void toDt(dt_t **pdt);
|
|
330 };
|
|
331
|
|
332 struct TypeInfoInterfaceDeclaration : TypeInfoDeclaration
|
|
333 {
|
|
334 TypeInfoInterfaceDeclaration(Type *tinfo);
|
|
335
|
|
336 void toDt(dt_t **pdt);
|
|
337 };
|
|
338
|
|
339 struct TypeInfoTypedefDeclaration : TypeInfoDeclaration
|
|
340 {
|
|
341 TypeInfoTypedefDeclaration(Type *tinfo);
|
|
342
|
|
343 void toDt(dt_t **pdt);
|
|
344 };
|
|
345
|
|
346 struct TypeInfoPointerDeclaration : TypeInfoDeclaration
|
|
347 {
|
|
348 TypeInfoPointerDeclaration(Type *tinfo);
|
|
349
|
|
350 void toDt(dt_t **pdt);
|
|
351 };
|
|
352
|
|
353 struct TypeInfoArrayDeclaration : TypeInfoDeclaration
|
|
354 {
|
|
355 TypeInfoArrayDeclaration(Type *tinfo);
|
|
356
|
|
357 void toDt(dt_t **pdt);
|
|
358 };
|
|
359
|
|
360 struct TypeInfoStaticArrayDeclaration : TypeInfoDeclaration
|
|
361 {
|
|
362 TypeInfoStaticArrayDeclaration(Type *tinfo);
|
|
363
|
|
364 void toDt(dt_t **pdt);
|
|
365 };
|
|
366
|
|
367 struct TypeInfoAssociativeArrayDeclaration : TypeInfoDeclaration
|
|
368 {
|
|
369 TypeInfoAssociativeArrayDeclaration(Type *tinfo);
|
|
370
|
|
371 void toDt(dt_t **pdt);
|
|
372 };
|
|
373
|
|
374 struct TypeInfoEnumDeclaration : TypeInfoDeclaration
|
|
375 {
|
|
376 TypeInfoEnumDeclaration(Type *tinfo);
|
|
377
|
|
378 void toDt(dt_t **pdt);
|
|
379 };
|
|
380
|
|
381 struct TypeInfoFunctionDeclaration : TypeInfoDeclaration
|
|
382 {
|
|
383 TypeInfoFunctionDeclaration(Type *tinfo);
|
|
384
|
|
385 void toDt(dt_t **pdt);
|
|
386 };
|
|
387
|
|
388 struct TypeInfoDelegateDeclaration : TypeInfoDeclaration
|
|
389 {
|
|
390 TypeInfoDelegateDeclaration(Type *tinfo);
|
|
391
|
|
392 void toDt(dt_t **pdt);
|
|
393 };
|
|
394
|
|
395 struct TypeInfoTupleDeclaration : TypeInfoDeclaration
|
|
396 {
|
|
397 TypeInfoTupleDeclaration(Type *tinfo);
|
|
398
|
|
399 void toDt(dt_t **pdt);
|
|
400 };
|
|
401
|
|
402 struct ThisDeclaration : VarDeclaration
|
|
403 {
|
|
404 ThisDeclaration(Type *t);
|
|
405 Dsymbol *syntaxCopy(Dsymbol *);
|
|
406 };
|
|
407
|
|
408 enum ILS
|
|
409 {
|
|
410 ILSuninitialized, // not computed yet
|
|
411 ILSno, // cannot inline
|
|
412 ILSyes, // can inline
|
|
413 };
|
|
414
|
|
415 /**************************************************************/
|
|
416
|
|
417 struct FuncDeclaration : Declaration
|
|
418 {
|
|
419 Array *fthrows; // Array of Type's of exceptions (not used)
|
|
420 Statement *frequire;
|
|
421 Statement *fensure;
|
|
422 Statement *fbody;
|
|
423
|
|
424 Identifier *outId; // identifier for out statement
|
|
425 VarDeclaration *vresult; // variable corresponding to outId
|
|
426 LabelDsymbol *returnLabel; // where the return goes
|
|
427
|
|
428 DsymbolTable *localsymtab; // used to prevent symbols in different
|
|
429 // scopes from having the same name
|
|
430 VarDeclaration *vthis; // 'this' parameter (member and nested)
|
|
431 VarDeclaration *v_arguments; // '_arguments' parameter
|
|
432 #if IN_GCC
|
|
433 VarDeclaration *v_argptr; // '_argptr' variable
|
|
434 #endif
|
|
435 Dsymbols *parameters; // Array of VarDeclaration's for parameters
|
|
436 DsymbolTable *labtab; // statement label symbol table
|
|
437 Declaration *overnext; // next in overload list
|
|
438 Loc endloc; // location of closing curly bracket
|
|
439 int vtblIndex; // for member functions, index into vtbl[]
|
|
440 int naked; // !=0 if naked
|
|
441 int inlineAsm; // !=0 if has inline assembler
|
|
442 ILS inlineStatus;
|
|
443 int inlineNest; // !=0 if nested inline
|
|
444 int cantInterpret; // !=0 if cannot interpret function
|
|
445 int semanticRun; // !=0 if semantic3() had been run
|
|
446 int nestedFrameRef; // !=0 if nested variables referenced frame ptr
|
|
447 ForeachStatement *fes; // if foreach body, this is the foreach
|
|
448 int introducing; // !=0 if 'introducing' function
|
|
449 Type *tintro; // if !=NULL, then this is the type
|
|
450 // of the 'introducing' function
|
|
451 // this one is overriding
|
|
452 int inferRetType; // !=0 if return type is to be inferred
|
|
453 Scope *scope; // !=NULL means context to use
|
|
454
|
|
455 // Things that should really go into Scope
|
|
456 int hasReturnExp; // 1 if there's a return exp; statement
|
|
457 // 2 if there's a throw statement
|
|
458 // 4 if there's an assert(0)
|
|
459 // 8 if there's inline asm
|
|
460
|
|
461 // Support for NRVO (named return value optimization)
|
|
462 int nrvo_can; // !=0 means we can do it
|
|
463 VarDeclaration *nrvo_var; // variable to replace with shidden
|
|
464 Symbol *shidden; // hidden pointer passed to function
|
|
465
|
|
466 FuncDeclaration(Loc loc, Loc endloc, Identifier *id, enum STC storage_class, Type *type);
|
|
467 Dsymbol *syntaxCopy(Dsymbol *);
|
|
468 void semantic(Scope *sc);
|
|
469 void semantic2(Scope *sc);
|
|
470 void semantic3(Scope *sc);
|
|
471 void toCBuffer(OutBuffer *buf, HdrGenState *hgs);
|
|
472 void bodyToCBuffer(OutBuffer *buf, HdrGenState *hgs);
|
|
473 int overrides(FuncDeclaration *fd);
|
|
474 int overloadInsert(Dsymbol *s);
|
|
475 FuncDeclaration *overloadExactMatch(Type *t);
|
|
476 FuncDeclaration *overloadResolve(Loc loc, Expressions *arguments);
|
|
477 LabelDsymbol *searchLabel(Identifier *ident);
|
|
478 AggregateDeclaration *isThis();
|
|
479 AggregateDeclaration *isMember2();
|
|
480 int getLevel(Loc loc, FuncDeclaration *fd); // lexical nesting level difference
|
|
481 void appendExp(Expression *e);
|
|
482 void appendState(Statement *s);
|
|
483 char *mangle();
|
|
484 int isMain();
|
|
485 int isWinMain();
|
|
486 int isDllMain();
|
|
487 int isExport();
|
|
488 int isImportedSymbol();
|
|
489 int isAbstract();
|
|
490 int isCodeseg();
|
|
491 virtual int isNested();
|
|
492 int needThis();
|
|
493 virtual int isVirtual();
|
|
494 virtual int addPreInvariant();
|
|
495 virtual int addPostInvariant();
|
|
496 Expression *interpret(InterState *istate, Expressions *arguments);
|
|
497 void inlineScan();
|
|
498 int canInline(int hasthis, int hdrscan = 0);
|
|
499 Expression *doInline(InlineScanState *iss, Expression *ethis, Array *arguments);
|
|
500 char *kind();
|
|
501 void toDocBuffer(OutBuffer *buf);
|
|
502
|
|
503 static FuncDeclaration *genCfunc(Type *treturn, char *name);
|
|
504 static FuncDeclaration *genCfunc(Type *treturn, Identifier *id);
|
|
505
|
|
506 Symbol *toSymbol();
|
|
507 Symbol *toThunkSymbol(int offset); // thunk version
|
|
508 void toObjFile(); // compile to .obj file
|
|
509 int cvMember(unsigned char *p);
|
|
510
|
|
511 FuncDeclaration *isFuncDeclaration() { return this; }
|
|
512 };
|
|
513
|
|
514 struct FuncAliasDeclaration : FuncDeclaration
|
|
515 {
|
|
516 FuncDeclaration *funcalias;
|
|
517
|
|
518 FuncAliasDeclaration(FuncDeclaration *funcalias);
|
|
519
|
|
520 FuncAliasDeclaration *isFuncAliasDeclaration() { return this; }
|
|
521 char *kind();
|
|
522 Symbol *toSymbol();
|
|
523 };
|
|
524
|
|
525 struct FuncLiteralDeclaration : FuncDeclaration
|
|
526 {
|
|
527 enum TOK tok; // TOKfunction or TOKdelegate
|
|
528
|
|
529 FuncLiteralDeclaration(Loc loc, Loc endloc, Type *type, enum TOK tok,
|
|
530 ForeachStatement *fes);
|
|
531 void toCBuffer(OutBuffer *buf, HdrGenState *hgs);
|
|
532 Dsymbol *syntaxCopy(Dsymbol *);
|
|
533 int isNested();
|
|
534
|
|
535 FuncLiteralDeclaration *isFuncLiteralDeclaration() { return this; }
|
|
536 char *kind();
|
|
537 };
|
|
538
|
|
539 struct CtorDeclaration : FuncDeclaration
|
|
540 { Arguments *arguments;
|
|
541 int varargs;
|
|
542
|
|
543 CtorDeclaration(Loc loc, Loc endloc, Arguments *arguments, int varargs);
|
|
544 Dsymbol *syntaxCopy(Dsymbol *);
|
|
545 void semantic(Scope *sc);
|
|
546 void toCBuffer(OutBuffer *buf, HdrGenState *hgs);
|
|
547 char *kind();
|
|
548 char *toChars();
|
|
549 int isVirtual();
|
|
550 int addPreInvariant();
|
|
551 int addPostInvariant();
|
|
552 void toDocBuffer(OutBuffer *buf);
|
|
553
|
|
554 CtorDeclaration *isCtorDeclaration() { return this; }
|
|
555 };
|
|
556
|
|
557 struct DtorDeclaration : FuncDeclaration
|
|
558 {
|
|
559 DtorDeclaration(Loc loc, Loc endloc);
|
|
560 Dsymbol *syntaxCopy(Dsymbol *);
|
|
561 void semantic(Scope *sc);
|
|
562 void toCBuffer(OutBuffer *buf, HdrGenState *hgs);
|
|
563 int isVirtual();
|
|
564 int addPreInvariant();
|
|
565 int addPostInvariant();
|
|
566 int overloadInsert(Dsymbol *s);
|
|
567 void emitComment(Scope *sc);
|
|
568
|
|
569 DtorDeclaration *isDtorDeclaration() { return this; }
|
|
570 };
|
|
571
|
|
572 struct StaticCtorDeclaration : FuncDeclaration
|
|
573 {
|
|
574 StaticCtorDeclaration(Loc loc, Loc endloc);
|
|
575 Dsymbol *syntaxCopy(Dsymbol *);
|
|
576 void semantic(Scope *sc);
|
|
577 AggregateDeclaration *isThis();
|
|
578 int isStaticConstructor();
|
|
579 int isVirtual();
|
|
580 int addPreInvariant();
|
|
581 int addPostInvariant();
|
|
582 void emitComment(Scope *sc);
|
|
583 void toCBuffer(OutBuffer *buf, HdrGenState *hgs);
|
|
584
|
|
585 StaticCtorDeclaration *isStaticCtorDeclaration() { return this; }
|
|
586 };
|
|
587
|
|
588 struct StaticDtorDeclaration : FuncDeclaration
|
|
589 {
|
|
590 StaticDtorDeclaration(Loc loc, Loc endloc);
|
|
591 Dsymbol *syntaxCopy(Dsymbol *);
|
|
592 void semantic(Scope *sc);
|
|
593 AggregateDeclaration *isThis();
|
|
594 int isStaticDestructor();
|
|
595 int isVirtual();
|
|
596 int addPreInvariant();
|
|
597 int addPostInvariant();
|
|
598 void emitComment(Scope *sc);
|
|
599 void toCBuffer(OutBuffer *buf, HdrGenState *hgs);
|
|
600
|
|
601 StaticDtorDeclaration *isStaticDtorDeclaration() { return this; }
|
|
602 };
|
|
603
|
|
604 struct InvariantDeclaration : FuncDeclaration
|
|
605 {
|
|
606 InvariantDeclaration(Loc loc, Loc endloc);
|
|
607 Dsymbol *syntaxCopy(Dsymbol *);
|
|
608 void semantic(Scope *sc);
|
|
609 int isVirtual();
|
|
610 int addPreInvariant();
|
|
611 int addPostInvariant();
|
|
612 void emitComment(Scope *sc);
|
|
613 void toCBuffer(OutBuffer *buf, HdrGenState *hgs);
|
|
614
|
|
615 InvariantDeclaration *isInvariantDeclaration() { return this; }
|
|
616 };
|
|
617
|
|
618
|
|
619 struct UnitTestDeclaration : FuncDeclaration
|
|
620 {
|
|
621 UnitTestDeclaration(Loc loc, Loc endloc);
|
|
622 Dsymbol *syntaxCopy(Dsymbol *);
|
|
623 void semantic(Scope *sc);
|
|
624 AggregateDeclaration *isThis();
|
|
625 int isVirtual();
|
|
626 int addPreInvariant();
|
|
627 int addPostInvariant();
|
|
628 void toCBuffer(OutBuffer *buf, HdrGenState *hgs);
|
|
629
|
|
630 UnitTestDeclaration *isUnitTestDeclaration() { return this; }
|
|
631 };
|
|
632
|
|
633 struct NewDeclaration : FuncDeclaration
|
|
634 { Arguments *arguments;
|
|
635 int varargs;
|
|
636
|
|
637 NewDeclaration(Loc loc, Loc endloc, Arguments *arguments, int varargs);
|
|
638 Dsymbol *syntaxCopy(Dsymbol *);
|
|
639 void semantic(Scope *sc);
|
|
640 void toCBuffer(OutBuffer *buf, HdrGenState *hgs);
|
|
641 char *kind();
|
|
642 int isVirtual();
|
|
643 int addPreInvariant();
|
|
644 int addPostInvariant();
|
|
645
|
|
646 NewDeclaration *isNewDeclaration() { return this; }
|
|
647 };
|
|
648
|
|
649
|
|
650 struct DeleteDeclaration : FuncDeclaration
|
|
651 { Arguments *arguments;
|
|
652
|
|
653 DeleteDeclaration(Loc loc, Loc endloc, Arguments *arguments);
|
|
654 Dsymbol *syntaxCopy(Dsymbol *);
|
|
655 void semantic(Scope *sc);
|
|
656 void toCBuffer(OutBuffer *buf, HdrGenState *hgs);
|
|
657 char *kind();
|
|
658 int isDelete();
|
|
659 int isVirtual();
|
|
660 int addPreInvariant();
|
|
661 int addPostInvariant();
|
|
662 #ifdef _DH
|
|
663 DeleteDeclaration *isDeleteDeclaration() { return this; }
|
|
664 #endif
|
|
665 };
|
|
666
|
|
667 #endif /* DMD_DECLARATION_H */
|