root/trunk/src/enum.h

Revision 583, 2.3 kB (checked in by walter, 2 years ago)

workaround for another fwd reference anonymous enum bug

  • Property svn:eol-style set to native
Line 
1 // Compiler implementation of the D programming language
2 // Copyright (c) 1999-2008 by Digital Mars
3 // All Rights Reserved
4 // written by Walter Bright
5 // http://www.digitalmars.com
6 // License for redistribution is by either the Artistic License
7 // in artistic.txt, or the GNU General Public License in gnu.txt.
8 // See the included readme.txt for details.
9
10 #ifndef DMD_ENUM_H
11 #define DMD_ENUM_H
12
13 #ifdef __DMC__
14 #pragma once
15 #endif /* __DMC__ */
16
17 #include "root.h"
18 #include "dsymbol.h"
19
20 struct Identifier;
21 struct Type;
22 struct Expression;
23 #ifdef _DH
24 struct HdrGenState;
25 #endif
26
27
28 struct EnumDeclaration : ScopeDsymbol
29 {   /* enum ident : memtype { ... }
30      */
31     Type *type;                 // the TypeEnum
32     Type *memtype;              // type of the members
33
34 #if DMDV1
35     dinteger_t maxval;
36     dinteger_t minval;
37     dinteger_t defaultval;      // default initializer
38 #else
39     Expression *maxval;
40     Expression *minval;
41     Expression *defaultval;     // default initializer
42 #endif
43     int isdeprecated;
44     int isdone;                 // 0: not done
45                                 // 1: semantic() successfully completed
46
47     EnumDeclaration(Loc loc, Identifier *id, Type *memtype);
48     Dsymbol *syntaxCopy(Dsymbol *s);
49     void semantic0(Scope *sc);
50     void semantic(Scope *sc);
51     int oneMember(Dsymbol **ps);
52     void toCBuffer(OutBuffer *buf, HdrGenState *hgs);
53     Type *getType();
54     const char *kind();
55 #if DMDV2
56     Dsymbol *search(Loc, Identifier *ident, int flags);
57 #endif
58     int isDeprecated();                 // is Dsymbol deprecated?
59
60     void emitComment(Scope *sc);
61     void toJsonBuffer(OutBuffer *buf);
62     void toDocBuffer(OutBuffer *buf);
63
64     EnumDeclaration *isEnumDeclaration() { return this; }
65
66     void toObjFile(int multiobj);                       // compile to .obj file
67     void toDebug();
68     int cvMember(unsigned char *p);
69
70     Symbol *sinit;
71     Symbol *toInitializer();
72 };
73
74
75 struct EnumMember : Dsymbol
76 {
77     Expression *value;
78     Type *type;
79
80     EnumMember(Loc loc, Identifier *id, Expression *value, Type *type);
81     Dsymbol *syntaxCopy(Dsymbol *s);
82     void toCBuffer(OutBuffer *buf, HdrGenState *hgs);
83     const char *kind();
84
85     void emitComment(Scope *sc);
86     void toJsonBuffer(OutBuffer *buf);
87     void toDocBuffer(OutBuffer *buf);
88
89     EnumMember *isEnumMember() { return this; }
90 };
91
92 #endif /* DMD_ENUM_H */
Note: See TracBrowser for help on using the browser.