comparison dmd/StructDeclaration.d @ 135:af1bebfd96a4 dmd2037

dmd 2.038
author Eldar Insafutdinov <e.insafutdinov@gmail.com>
date Mon, 13 Sep 2010 22:19:42 +0100
parents 206db751bd4c
children 90821c10b6a7
comparison
equal deleted inserted replaced
134:4251f96733f4 135:af1bebfd96a4
205 if (isUnionDeclaration()) 205 if (isUnionDeclaration())
206 sc2.inunion = 1; 206 sc2.inunion = 1;
207 sc2.protection = PROT.PROTpublic; 207 sc2.protection = PROT.PROTpublic;
208 sc2.explicitProtection = 0; 208 sc2.explicitProtection = 0;
209 209
210 int members_dim = members.dim; 210
211 /* Set scope so if there are forward references, we still might be able to
212 * resolve individual members like enums.
213 */
214 foreach (s; members)
215 {
216 /* There are problems doing this in the general case because
217 * Scope keeps track of things like 'offset'
218 */
219 if (s.isEnumDeclaration() || (s.isAggregateDeclaration() && s.ident))
220 {
221 //printf("setScope %s %s\n", s->kind(), s->toChars());
222 s.setScope(sc2);
223 }
224 }
225
211 foreach(Dsymbol s; members) 226 foreach(Dsymbol s; members)
212 { 227 {
213 s.semantic(sc2); 228 s.semantic(sc2);
214 if (isUnionDeclaration()) 229 if (isUnionDeclaration())
215 sc2.offset = 0; 230 sc2.offset = 0;
410 semantic2(sc); 425 semantic2(sc);
411 semantic3(sc); 426 semantic3(sc);
412 } 427 }
413 } 428 }
414 429
430 Dsymbol search(Loc loc, Identifier ident, int flags)
431 {
432 //printf("%s.StructDeclaration::search('%s')\n", toChars(), ident->toChars());
433
434 if (scope_)
435 semantic(scope_);
436
437 if (!members || !symtab)
438 {
439 error("is forward referenced when looking for '%s'", ident.toChars());
440 return null;
441 }
442
443 return ScopeDsymbol.search(loc, ident, flags);
444 }
445
415 override void toCBuffer(OutBuffer buf, HdrGenState* hgs) 446 override void toCBuffer(OutBuffer buf, HdrGenState* hgs)
416 { 447 {
417 assert(false); 448 assert(false);
418 } 449 }
419 450