root/branches/dmdfe-2.0/enum.h

Revision 905, 2.0 kB (checked in by Gregor, 3 months ago)

MERGE: DMD 2.016

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 V1
35     integer_t maxval;
36     integer_t minval;
37     integer_t defaultval;   // default initializer
38 #else
39     Expression *maxval;
40     Expression *minval;
41     Expression *defaultval; // default initializer
42
43     Scope *scope;       // !=NULL means context to use
44 #endif
45     int isdeprecated;
46
47     EnumDeclaration(Loc loc, Identifier *id, Type *memtype);
48     Dsymbol *syntaxCopy(Dsymbol *s);
49     void semantic(Scope *sc);
50     int oneMember(Dsymbol **ps);
51     void toCBuffer(OutBuffer *buf, HdrGenState *hgs);
52     Type *getType();
53     const char *kind();
54 #if V2
55     Dsymbol *search(Loc, Identifier *ident, int flags);
56 #endif
57     int isDeprecated();         // is Dsymbol deprecated?
58
59     void emitComment(Scope *sc);
60     void toDocBuffer(OutBuffer *buf);
61
62     EnumDeclaration *isEnumDeclaration() { return this; }
63
64     void toDebug();
65
66     Symbol *sinit;
67     Symbol *toInitializer();
68 };
69
70
71 struct EnumMember : Dsymbol
72 {
73     Expression *value;
74     Type *type;
75
76     EnumMember(Loc loc, Identifier *id, Expression *value, Type *type);
77     Dsymbol *syntaxCopy(Dsymbol *s);
78     void toCBuffer(OutBuffer *buf, HdrGenState *hgs);
79     const char *kind();
80
81     void emitComment(Scope *sc);
82     void toDocBuffer(OutBuffer *buf);
83
84     EnumMember *isEnumMember() { return this; }
85 };
86
87 #endif /* DMD_ENUM_H */
Note: See TracBrowser for help on using the browser.