Mercurial > projects > ddmd
comparison dmd/EnumDeclaration.d @ 138:90821c10b6a7
2.039
author | Trass3r |
---|---|
date | Tue, 14 Sep 2010 00:00:24 +0200 |
parents | e28b18c23469 |
children | e3afd1303184 |
comparison
equal
deleted
inserted
replaced
137:09c858522d55 | 138:90821c10b6a7 |
---|---|
56 { | 56 { |
57 Expression maxval; | 57 Expression maxval; |
58 Expression minval; | 58 Expression minval; |
59 Expression defaultval; // default initializer | 59 Expression defaultval; // default initializer |
60 } | 60 } |
61 bool isdeprecated; | 61 bool isdeprecated = false; |
62 | 62 bool isdone = false; // 0: not done |
63 // 1: semantic() successfully completed | |
64 | |
63 this(Loc loc, Identifier id, Type memtype) | 65 this(Loc loc, Identifier id, Type memtype) |
64 { | 66 { |
65 super(id); | 67 super(id); |
66 this.loc = loc; | 68 this.loc = loc; |
67 type = new TypeEnum(this); | 69 type = new TypeEnum(this); |
101 memtype = Type.tint32; // case 1) enum ident { ... } | 103 memtype = Type.tint32; // case 1) enum ident { ... } |
102 } | 104 } |
103 | 105 |
104 if (symtab) // if already done | 106 if (symtab) // if already done |
105 { | 107 { |
106 if (!scope_) | 108 if (isdone || !scope_) |
107 return; // semantic() already completed | 109 return; // semantic() already completed |
108 } | 110 } |
109 else | 111 else |
110 symtab = new DsymbolTable(); | 112 symtab = new DsymbolTable(); |
111 | 113 |
144 scope_.module_.addDeferredSemantic(this); | 146 scope_.module_.addDeferredSemantic(this); |
145 writef("\tdeferring %s\n", toChars()); | 147 writef("\tdeferring %s\n", toChars()); |
146 return; | 148 return; |
147 } | 149 } |
148 } | 150 } |
149 static if (false) { | 151 static if (false) |
152 { | |
150 // Decided to abandon this restriction for D 2.0 | 153 // Decided to abandon this restriction for D 2.0 |
151 if (!memtype.isintegral()) | 154 if (!memtype.isintegral()) |
152 { error("base type must be of integral type, not %s", memtype.toChars()); | 155 { error("base type must be of integral type, not %s", memtype.toChars()); |
153 memtype = Type.tint32; | 156 memtype = Type.tint32; |
154 } | 157 } |
155 } | 158 } |
156 } | 159 } |
160 | |
161 isdone = true; | |
157 | 162 |
158 type = type.semantic(loc, sc); | 163 type = type.semantic(loc, sc); |
159 if (isAnonymous()) | 164 if (isAnonymous()) |
160 sce = sc; | 165 sce = sc; |
161 else | 166 else |