comparison dmd/mtype.c @ 913:29c0d1194033

Fix #198 and #199 by making CTFE on static struct initializers work. Renamed SymbolDeclaration to StaticStructInitDeclaration to make its usage clearer.
author Christian Kamm <kamm incasoftware de>
date Sun, 01 Feb 2009 20:20:56 +0100
parents 177afbf5297b
children 7985bb036db4
comparison
equal deleted inserted replaced
912:16264a3973bf 913:29c0d1194033
4582 sym->size(0); // give error for forward references 4582 sym->size(0); // give error for forward references
4583 return sym->structalign; 4583 return sym->structalign;
4584 } 4584 }
4585 4585
4586 Expression *TypeStruct::defaultInit(Loc loc) 4586 Expression *TypeStruct::defaultInit(Loc loc)
4587 { Symbol *s; 4587 { Declaration *d;
4588 Declaration *d;
4589 4588
4590 #if LOGDEFAULTINIT 4589 #if LOGDEFAULTINIT
4591 printf("TypeStruct::defaultInit() '%s'\n", toChars()); 4590 printf("TypeStruct::defaultInit() '%s'\n", toChars());
4592 #endif 4591 #endif
4593 s = sym->toInitializer(); 4592 d = new StaticStructInitDeclaration(sym->loc, sym);
4594 d = new SymbolDeclaration(sym->loc, s, sym);
4595 assert(d); 4593 assert(d);
4596 d->type = this; 4594 d->type = this;
4597 return new VarExp(sym->loc, d); 4595 return new VarExp(sym->loc, d);
4598 } 4596 }
4599 4597