Mercurial > projects > ldc
comparison dmd/declaration.h @ 1:c53b6e3fe49a trunk
[svn r5] Initial commit. Most things are very rough.
author | lindquist |
---|---|
date | Sat, 01 Sep 2007 21:43:27 +0200 |
parents | |
children | dafae18f9c08 |
comparison
equal
deleted
inserted
replaced
0:a9e71648e74d | 1:c53b6e3fe49a |
---|---|
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 // llvm stuff | |
131 llvm::Value* llvmValue; | |
132 }; | |
133 | |
134 /**************************************************************/ | |
135 | |
136 struct TupleDeclaration : Declaration | |
137 { | |
138 Objects *objects; | |
139 int isexp; // 1: expression tuple | |
140 | |
141 TypeTuple *tupletype; // !=NULL if this is a type tuple | |
142 | |
143 TupleDeclaration(Loc loc, Identifier *ident, Objects *objects); | |
144 Dsymbol *syntaxCopy(Dsymbol *); | |
145 char *kind(); | |
146 Type *getType(); | |
147 int needThis(); | |
148 | |
149 TupleDeclaration *isTupleDeclaration() { return this; } | |
150 }; | |
151 | |
152 /**************************************************************/ | |
153 | |
154 struct TypedefDeclaration : Declaration | |
155 { | |
156 Type *basetype; | |
157 Initializer *init; | |
158 int sem; // 0: semantic() has not been run | |
159 // 1: semantic() is in progress | |
160 // 2: semantic() has been run | |
161 // 3: semantic2() has been run | |
162 int inuse; // used to detect typedef cycles | |
163 | |
164 TypedefDeclaration(Loc loc, Identifier *ident, Type *basetype, Initializer *init); | |
165 Dsymbol *syntaxCopy(Dsymbol *); | |
166 void semantic(Scope *sc); | |
167 void semantic2(Scope *sc); | |
168 char *mangle(); | |
169 char *kind(); | |
170 Type *getType(); | |
171 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
172 #ifdef _DH | |
173 Type *htype; | |
174 Type *hbasetype; | |
175 #endif | |
176 | |
177 void toDocBuffer(OutBuffer *buf); | |
178 | |
179 void toObjFile(); // compile to .obj file | |
180 void toDebug(); | |
181 int cvMember(unsigned char *p); | |
182 | |
183 TypedefDeclaration *isTypedefDeclaration() { return this; } | |
184 | |
185 Symbol *sinit; | |
186 Symbol *toInitializer(); | |
187 }; | |
188 | |
189 /**************************************************************/ | |
190 | |
191 struct AliasDeclaration : Declaration | |
192 { | |
193 Dsymbol *aliassym; | |
194 Dsymbol *overnext; // next in overload list | |
195 int inSemantic; | |
196 | |
197 AliasDeclaration(Loc loc, Identifier *ident, Type *type); | |
198 AliasDeclaration(Loc loc, Identifier *ident, Dsymbol *s); | |
199 Dsymbol *syntaxCopy(Dsymbol *); | |
200 void semantic(Scope *sc); | |
201 int overloadInsert(Dsymbol *s); | |
202 char *kind(); | |
203 Type *getType(); | |
204 Dsymbol *toAlias(); | |
205 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
206 #ifdef _DH | |
207 Type *htype; | |
208 Dsymbol *haliassym; | |
209 #endif | |
210 | |
211 void toDocBuffer(OutBuffer *buf); | |
212 | |
213 AliasDeclaration *isAliasDeclaration() { return this; } | |
214 }; | |
215 | |
216 /**************************************************************/ | |
217 | |
218 struct VarDeclaration : Declaration | |
219 { | |
220 Initializer *init; | |
221 unsigned offset; | |
222 int noauto; // no auto semantics | |
223 int nestedref; // referenced by a lexically nested function | |
224 int inuse; | |
225 int ctorinit; // it has been initialized in a ctor | |
226 int onstack; // 1: it has been allocated on the stack | |
227 // 2: on stack, run destructor anyway | |
228 int canassign; // it can be assigned to | |
229 Dsymbol *aliassym; // if redone as alias to another symbol | |
230 Expression *value; // when interpreting, this is the value | |
231 // (NULL if value not determinable) | |
232 | |
233 VarDeclaration(Loc loc, Type *t, Identifier *id, Initializer *init); | |
234 Dsymbol *syntaxCopy(Dsymbol *); | |
235 void semantic(Scope *sc); | |
236 void semantic2(Scope *sc); | |
237 char *kind(); | |
238 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
239 #ifdef _DH | |
240 Type *htype; | |
241 Initializer *hinit; | |
242 #endif | |
243 int needThis(); | |
244 int isImportedSymbol(); | |
245 int isDataseg(); | |
246 int hasPointers(); | |
247 Expression *callAutoDtor(); | |
248 ExpInitializer *getExpInitializer(); | |
249 void checkCtorConstInit(); | |
250 void checkNestedReference(Scope *sc, Loc loc); | |
251 Dsymbol *toAlias(); | |
252 | |
253 Symbol *toSymbol(); | |
254 void toObjFile(); // compile to .obj file | |
255 int cvMember(unsigned char *p); | |
256 | |
257 // Eliminate need for dynamic_cast | |
258 VarDeclaration *isVarDeclaration() { return (VarDeclaration *)this; } | |
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(); | |
289 }; | |
290 | |
291 struct ModuleInfoDeclaration : VarDeclaration | |
292 { | |
293 Module *mod; | |
294 | |
295 ModuleInfoDeclaration(Module *mod); | |
296 Dsymbol *syntaxCopy(Dsymbol *); | |
297 void semantic(Scope *sc); | |
298 | |
299 void emitComment(Scope *sc); | |
300 | |
301 Symbol *toSymbol(); | |
302 }; | |
303 | |
304 struct TypeInfoDeclaration : VarDeclaration | |
305 { | |
306 Type *tinfo; | |
307 | |
308 TypeInfoDeclaration(Type *tinfo, int internal); | |
309 Dsymbol *syntaxCopy(Dsymbol *); | |
310 void semantic(Scope *sc); | |
311 | |
312 void emitComment(Scope *sc); | |
313 | |
314 Symbol *toSymbol(); | |
315 void toObjFile(); // compile to .obj file | |
316 virtual void toDt(dt_t **pdt); | |
317 | |
318 virtual TypeInfoDeclaration* isTypeInfoDeclaration() { return this; } | |
319 }; | |
320 | |
321 struct TypeInfoStructDeclaration : TypeInfoDeclaration | |
322 { | |
323 TypeInfoStructDeclaration(Type *tinfo); | |
324 | |
325 void toDt(dt_t **pdt); | |
326 }; | |
327 | |
328 struct TypeInfoClassDeclaration : TypeInfoDeclaration | |
329 { | |
330 TypeInfoClassDeclaration(Type *tinfo); | |
331 | |
332 void toDt(dt_t **pdt); | |
333 }; | |
334 | |
335 struct TypeInfoInterfaceDeclaration : TypeInfoDeclaration | |
336 { | |
337 TypeInfoInterfaceDeclaration(Type *tinfo); | |
338 | |
339 void toDt(dt_t **pdt); | |
340 }; | |
341 | |
342 struct TypeInfoTypedefDeclaration : TypeInfoDeclaration | |
343 { | |
344 TypeInfoTypedefDeclaration(Type *tinfo); | |
345 | |
346 void toDt(dt_t **pdt); | |
347 }; | |
348 | |
349 struct TypeInfoPointerDeclaration : TypeInfoDeclaration | |
350 { | |
351 TypeInfoPointerDeclaration(Type *tinfo); | |
352 | |
353 void toDt(dt_t **pdt); | |
354 }; | |
355 | |
356 struct TypeInfoArrayDeclaration : TypeInfoDeclaration | |
357 { | |
358 TypeInfoArrayDeclaration(Type *tinfo); | |
359 | |
360 void toDt(dt_t **pdt); | |
361 }; | |
362 | |
363 struct TypeInfoStaticArrayDeclaration : TypeInfoDeclaration | |
364 { | |
365 TypeInfoStaticArrayDeclaration(Type *tinfo); | |
366 | |
367 void toDt(dt_t **pdt); | |
368 }; | |
369 | |
370 struct TypeInfoAssociativeArrayDeclaration : TypeInfoDeclaration | |
371 { | |
372 TypeInfoAssociativeArrayDeclaration(Type *tinfo); | |
373 | |
374 void toDt(dt_t **pdt); | |
375 }; | |
376 | |
377 struct TypeInfoEnumDeclaration : TypeInfoDeclaration | |
378 { | |
379 TypeInfoEnumDeclaration(Type *tinfo); | |
380 | |
381 void toDt(dt_t **pdt); | |
382 }; | |
383 | |
384 struct TypeInfoFunctionDeclaration : TypeInfoDeclaration | |
385 { | |
386 TypeInfoFunctionDeclaration(Type *tinfo); | |
387 | |
388 void toDt(dt_t **pdt); | |
389 }; | |
390 | |
391 struct TypeInfoDelegateDeclaration : TypeInfoDeclaration | |
392 { | |
393 TypeInfoDelegateDeclaration(Type *tinfo); | |
394 | |
395 void toDt(dt_t **pdt); | |
396 }; | |
397 | |
398 struct TypeInfoTupleDeclaration : TypeInfoDeclaration | |
399 { | |
400 TypeInfoTupleDeclaration(Type *tinfo); | |
401 | |
402 void toDt(dt_t **pdt); | |
403 }; | |
404 | |
405 struct ThisDeclaration : VarDeclaration | |
406 { | |
407 ThisDeclaration(Type *t); | |
408 Dsymbol *syntaxCopy(Dsymbol *); | |
409 }; | |
410 | |
411 enum ILS | |
412 { | |
413 ILSuninitialized, // not computed yet | |
414 ILSno, // cannot inline | |
415 ILSyes, // can inline | |
416 }; | |
417 | |
418 /**************************************************************/ | |
419 | |
420 struct FuncDeclaration : Declaration | |
421 { | |
422 Array *fthrows; // Array of Type's of exceptions (not used) | |
423 Statement *frequire; | |
424 Statement *fensure; | |
425 Statement *fbody; | |
426 | |
427 Identifier *outId; // identifier for out statement | |
428 VarDeclaration *vresult; // variable corresponding to outId | |
429 LabelDsymbol *returnLabel; // where the return goes | |
430 | |
431 DsymbolTable *localsymtab; // used to prevent symbols in different | |
432 // scopes from having the same name | |
433 VarDeclaration *vthis; // 'this' parameter (member and nested) | |
434 VarDeclaration *v_arguments; // '_arguments' parameter | |
435 #if IN_GCC | |
436 VarDeclaration *v_argptr; // '_argptr' variable | |
437 #endif | |
438 Dsymbols *parameters; // Array of VarDeclaration's for parameters | |
439 DsymbolTable *labtab; // statement label symbol table | |
440 Declaration *overnext; // next in overload list | |
441 Loc endloc; // location of closing curly bracket | |
442 int vtblIndex; // for member functions, index into vtbl[] | |
443 int naked; // !=0 if naked | |
444 int inlineAsm; // !=0 if has inline assembler | |
445 ILS inlineStatus; | |
446 int inlineNest; // !=0 if nested inline | |
447 int cantInterpret; // !=0 if cannot interpret function | |
448 int semanticRun; // !=0 if semantic3() had been run | |
449 int nestedFrameRef; // !=0 if nested variables referenced frame ptr | |
450 ForeachStatement *fes; // if foreach body, this is the foreach | |
451 int introducing; // !=0 if 'introducing' function | |
452 Type *tintro; // if !=NULL, then this is the type | |
453 // of the 'introducing' function | |
454 // this one is overriding | |
455 int inferRetType; // !=0 if return type is to be inferred | |
456 Scope *scope; // !=NULL means context to use | |
457 | |
458 // Things that should really go into Scope | |
459 int hasReturnExp; // 1 if there's a return exp; statement | |
460 // 2 if there's a throw statement | |
461 // 4 if there's an assert(0) | |
462 // 8 if there's inline asm | |
463 | |
464 // Support for NRVO (named return value optimization) | |
465 int nrvo_can; // !=0 means we can do it | |
466 VarDeclaration *nrvo_var; // variable to replace with shidden | |
467 Symbol *shidden; // hidden pointer passed to function | |
468 | |
469 FuncDeclaration(Loc loc, Loc endloc, Identifier *id, enum STC storage_class, Type *type); | |
470 Dsymbol *syntaxCopy(Dsymbol *); | |
471 void semantic(Scope *sc); | |
472 void semantic2(Scope *sc); | |
473 void semantic3(Scope *sc); | |
474 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
475 void bodyToCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
476 int overrides(FuncDeclaration *fd); | |
477 int overloadInsert(Dsymbol *s); | |
478 FuncDeclaration *overloadExactMatch(Type *t); | |
479 FuncDeclaration *overloadResolve(Loc loc, Expressions *arguments); | |
480 LabelDsymbol *searchLabel(Identifier *ident); | |
481 AggregateDeclaration *isThis(); | |
482 AggregateDeclaration *isMember2(); | |
483 int getLevel(Loc loc, FuncDeclaration *fd); // lexical nesting level difference | |
484 void appendExp(Expression *e); | |
485 void appendState(Statement *s); | |
486 char *mangle(); | |
487 int isMain(); | |
488 int isWinMain(); | |
489 int isDllMain(); | |
490 int isExport(); | |
491 int isImportedSymbol(); | |
492 int isAbstract(); | |
493 int isCodeseg(); | |
494 virtual int isNested(); | |
495 int needThis(); | |
496 virtual int isVirtual(); | |
497 virtual int addPreInvariant(); | |
498 virtual int addPostInvariant(); | |
499 Expression *interpret(InterState *istate, Expressions *arguments); | |
500 void inlineScan(); | |
501 int canInline(int hasthis, int hdrscan = 0); | |
502 Expression *doInline(InlineScanState *iss, Expression *ethis, Array *arguments); | |
503 char *kind(); | |
504 void toDocBuffer(OutBuffer *buf); | |
505 | |
506 static FuncDeclaration *genCfunc(Type *treturn, char *name); | |
507 static FuncDeclaration *genCfunc(Type *treturn, Identifier *id); | |
508 | |
509 Symbol *toSymbol(); | |
510 Symbol *toThunkSymbol(int offset); // thunk version | |
511 void toObjFile(); // compile to .obj file | |
512 int cvMember(unsigned char *p); | |
513 | |
514 FuncDeclaration *isFuncDeclaration() { return this; } | |
515 }; | |
516 | |
517 struct FuncAliasDeclaration : FuncDeclaration | |
518 { | |
519 FuncDeclaration *funcalias; | |
520 | |
521 FuncAliasDeclaration(FuncDeclaration *funcalias); | |
522 | |
523 FuncAliasDeclaration *isFuncAliasDeclaration() { return this; } | |
524 char *kind(); | |
525 Symbol *toSymbol(); | |
526 }; | |
527 | |
528 struct FuncLiteralDeclaration : FuncDeclaration | |
529 { | |
530 enum TOK tok; // TOKfunction or TOKdelegate | |
531 | |
532 FuncLiteralDeclaration(Loc loc, Loc endloc, Type *type, enum TOK tok, | |
533 ForeachStatement *fes); | |
534 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
535 Dsymbol *syntaxCopy(Dsymbol *); | |
536 int isNested(); | |
537 | |
538 FuncLiteralDeclaration *isFuncLiteralDeclaration() { return this; } | |
539 char *kind(); | |
540 }; | |
541 | |
542 struct CtorDeclaration : FuncDeclaration | |
543 { Arguments *arguments; | |
544 int varargs; | |
545 | |
546 CtorDeclaration(Loc loc, Loc endloc, Arguments *arguments, int varargs); | |
547 Dsymbol *syntaxCopy(Dsymbol *); | |
548 void semantic(Scope *sc); | |
549 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
550 char *kind(); | |
551 char *toChars(); | |
552 int isVirtual(); | |
553 int addPreInvariant(); | |
554 int addPostInvariant(); | |
555 void toDocBuffer(OutBuffer *buf); | |
556 | |
557 CtorDeclaration *isCtorDeclaration() { return this; } | |
558 }; | |
559 | |
560 struct DtorDeclaration : FuncDeclaration | |
561 { | |
562 DtorDeclaration(Loc loc, Loc endloc); | |
563 Dsymbol *syntaxCopy(Dsymbol *); | |
564 void semantic(Scope *sc); | |
565 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
566 int isVirtual(); | |
567 int addPreInvariant(); | |
568 int addPostInvariant(); | |
569 int overloadInsert(Dsymbol *s); | |
570 void emitComment(Scope *sc); | |
571 | |
572 DtorDeclaration *isDtorDeclaration() { return this; } | |
573 }; | |
574 | |
575 struct StaticCtorDeclaration : FuncDeclaration | |
576 { | |
577 StaticCtorDeclaration(Loc loc, Loc endloc); | |
578 Dsymbol *syntaxCopy(Dsymbol *); | |
579 void semantic(Scope *sc); | |
580 AggregateDeclaration *isThis(); | |
581 int isStaticConstructor(); | |
582 int isVirtual(); | |
583 int addPreInvariant(); | |
584 int addPostInvariant(); | |
585 void emitComment(Scope *sc); | |
586 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
587 | |
588 StaticCtorDeclaration *isStaticCtorDeclaration() { return this; } | |
589 }; | |
590 | |
591 struct StaticDtorDeclaration : FuncDeclaration | |
592 { | |
593 StaticDtorDeclaration(Loc loc, Loc endloc); | |
594 Dsymbol *syntaxCopy(Dsymbol *); | |
595 void semantic(Scope *sc); | |
596 AggregateDeclaration *isThis(); | |
597 int isStaticDestructor(); | |
598 int isVirtual(); | |
599 int addPreInvariant(); | |
600 int addPostInvariant(); | |
601 void emitComment(Scope *sc); | |
602 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
603 | |
604 StaticDtorDeclaration *isStaticDtorDeclaration() { return this; } | |
605 }; | |
606 | |
607 struct InvariantDeclaration : FuncDeclaration | |
608 { | |
609 InvariantDeclaration(Loc loc, Loc endloc); | |
610 Dsymbol *syntaxCopy(Dsymbol *); | |
611 void semantic(Scope *sc); | |
612 int isVirtual(); | |
613 int addPreInvariant(); | |
614 int addPostInvariant(); | |
615 void emitComment(Scope *sc); | |
616 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
617 | |
618 InvariantDeclaration *isInvariantDeclaration() { return this; } | |
619 }; | |
620 | |
621 | |
622 struct UnitTestDeclaration : FuncDeclaration | |
623 { | |
624 UnitTestDeclaration(Loc loc, Loc endloc); | |
625 Dsymbol *syntaxCopy(Dsymbol *); | |
626 void semantic(Scope *sc); | |
627 AggregateDeclaration *isThis(); | |
628 int isVirtual(); | |
629 int addPreInvariant(); | |
630 int addPostInvariant(); | |
631 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
632 | |
633 UnitTestDeclaration *isUnitTestDeclaration() { return this; } | |
634 }; | |
635 | |
636 struct NewDeclaration : FuncDeclaration | |
637 { Arguments *arguments; | |
638 int varargs; | |
639 | |
640 NewDeclaration(Loc loc, Loc endloc, Arguments *arguments, int varargs); | |
641 Dsymbol *syntaxCopy(Dsymbol *); | |
642 void semantic(Scope *sc); | |
643 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
644 char *kind(); | |
645 int isVirtual(); | |
646 int addPreInvariant(); | |
647 int addPostInvariant(); | |
648 | |
649 NewDeclaration *isNewDeclaration() { return this; } | |
650 }; | |
651 | |
652 | |
653 struct DeleteDeclaration : FuncDeclaration | |
654 { Arguments *arguments; | |
655 | |
656 DeleteDeclaration(Loc loc, Loc endloc, Arguments *arguments); | |
657 Dsymbol *syntaxCopy(Dsymbol *); | |
658 void semantic(Scope *sc); | |
659 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
660 char *kind(); | |
661 int isDelete(); | |
662 int isVirtual(); | |
663 int addPreInvariant(); | |
664 int addPostInvariant(); | |
665 #ifdef _DH | |
666 DeleteDeclaration *isDeleteDeclaration() { return this; } | |
667 #endif | |
668 }; | |
669 | |
670 #endif /* DMD_DECLARATION_H */ |