comparison dmd/TypeQualified.d @ 135:af1bebfd96a4 dmd2037

dmd 2.038
author Eldar Insafutdinov <e.insafutdinov@gmail.com>
date Mon, 13 Sep 2010 22:19:42 +0100
parents e28b18c23469
children e3afd1303184
comparison
equal deleted inserted replaced
134:4251f96733f4 135:af1bebfd96a4
20 import dmd.HdrGenState; 20 import dmd.HdrGenState;
21 import dmd.Scope; 21 import dmd.Scope;
22 import dmd.Dsymbol; 22 import dmd.Dsymbol;
23 import dmd.DYNCAST; 23 import dmd.DYNCAST;
24 import dmd.Expression; 24 import dmd.Expression;
25 import dmd.FuncDeclaration;
25 import dmd.Util; 26 import dmd.Util;
26 27
27 class TypeQualified : Type 28 class TypeQualified : Type
28 { 29 {
29 Loc loc; 30 Loc loc;
98 * if type, *pt is set 99 * if type, *pt is set
99 */ 100 */
100 void resolveHelper(Loc loc, Scope sc, Dsymbol s, Dsymbol scopesym, Expression* pe, Type* pt, Dsymbol* ps) 101 void resolveHelper(Loc loc, Scope sc, Dsymbol s, Dsymbol scopesym, Expression* pe, Type* pt, Dsymbol* ps)
101 { 102 {
102 VarDeclaration v; 103 VarDeclaration v;
104 FuncDeclaration fd;
103 EnumMember em; 105 EnumMember em;
104 TupleDeclaration td; 106 TupleDeclaration td;
105 Expression e; 107 Expression e;
106 108
107 static if (false) { 109 static if (false) {
172 L3: 174 L3:
173 for (; i < idents.dim; i++) 175 for (; i < idents.dim; i++)
174 { 176 {
175 id = cast(Identifier)idents.data[i]; 177 id = cast(Identifier)idents.data[i];
176 //printf("e: '%s', id: '%s', type = %p\n", e.toChars(), id.toChars(), e.type); 178 //printf("e: '%s', id: '%s', type = %p\n", e.toChars(), id.toChars(), e.type);
177 if (id == Id.offsetof) 179 if (id == Id.offsetof || !e.type)
178 { e = new DotIdExp(e.loc, e, id); 180 { e = new DotIdExp(e.loc, e, id);
179 e = e.semantic(sc); 181 e = e.semantic(sc);
180 } 182 }
181 else 183 else
182 e = e.type.dotExp(sc, e, id); 184 e = e.type.dotExp(sc, e, id);
193 } 195 }
194 196
195 v = s.isVarDeclaration(); 197 v = s.isVarDeclaration();
196 if (v) 198 if (v)
197 { 199 {
198 ///static if (false) { 200 *pe = new VarExp(loc, v);
199 /// // It's not a type, it's an expression 201 return;
200 /// Expression *e = v.getConstInitializer(); 202 }
201 /// if (e) 203 //#if 0
202 /// { 204 // fd = s->isFuncDeclaration();
203 /// *pe = e.copy(); // make copy so we can change loc 205 // if (fd)
204 /// (*pe).loc = loc; 206 // {
205 /// } 207 // *pe = new DsymbolExp(loc, fd, 1);
206 /// else 208 // return;
207 ///} 209 // }
208 { 210 //#endif
209 ///static if (false) {
210 /// WithScopeSymbol withsym;
211 /// if (scopesym && (withsym = scopesym.isWithScopeSymbol()) !is null)
212 /// {
213 /// // Same as wthis.ident
214 /// e = new VarExp(loc, withsym.withstate.wthis);
215 /// e = new DotIdExp(loc, e, ident);
216 /// //assert(0); // BUG: should handle this
217 /// }
218 /// else
219 ///}
220 *pe = new VarExp(loc, v);
221 }
222 return;
223 }
224 em = s.isEnumMember(); 211 em = s.isEnumMember();
225 if (em) 212 if (em)
226 { 213 {
227 // It's not a type, it's an expression 214 // It's not a type, it's an expression
228 *pe = em.value.copy(); 215 *pe = em.value.copy();