comparison dmd2/enum.h @ 758:f04dde6e882c

Added initial D2 support, D2 frontend and changes to codegen to make things compile.
author Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
date Tue, 11 Nov 2008 01:38:48 +0100
parents
children 638d16625da2
comparison
equal deleted inserted replaced
757:2c730d530c98 758:f04dde6e882c
1
2 // Compiler implementation of the D programming language
3 // Copyright (c) 1999-2008 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_ENUM_H
12 #define DMD_ENUM_H
13
14 #ifdef __DMC__
15 #pragma once
16 #endif /* __DMC__ */
17
18 #include "root.h"
19 #include "dsymbol.h"
20
21 struct Identifier;
22 struct Type;
23 struct Expression;
24 #ifdef _DH
25 struct HdrGenState;
26 #endif
27
28
29 struct EnumDeclaration : ScopeDsymbol
30 { /* enum ident : memtype { ... }
31 */
32 Type *type; // the TypeEnum
33 Type *memtype; // type of the members
34
35 #if DMDV1
36 integer_t maxval;
37 integer_t minval;
38 integer_t defaultval; // default initializer
39 #else
40 Expression *maxval;
41 Expression *minval;
42 Expression *defaultval; // default initializer
43
44 Scope *scope; // !=NULL means context to use
45 #endif
46 int isdeprecated;
47
48 EnumDeclaration(Loc loc, Identifier *id, Type *memtype);
49 Dsymbol *syntaxCopy(Dsymbol *s);
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 toDocBuffer(OutBuffer *buf);
62
63 EnumDeclaration *isEnumDeclaration() { return this; }
64
65 void toObjFile(int multiobj); // compile to .obj file
66 void toDebug();
67 int cvMember(unsigned char *p);
68
69 Symbol *sinit;
70 Symbol *toInitializer();
71 };
72
73
74 struct EnumMember : Dsymbol
75 {
76 Expression *value;
77 Type *type;
78
79 EnumMember(Loc loc, Identifier *id, Expression *value, Type *type);
80 Dsymbol *syntaxCopy(Dsymbol *s);
81 void toCBuffer(OutBuffer *buf, HdrGenState *hgs);
82 const char *kind();
83
84 void emitComment(Scope *sc);
85 void toDocBuffer(OutBuffer *buf);
86
87 EnumMember *isEnumMember() { return this; }
88 };
89
90 #endif /* DMD_ENUM_H */