Mercurial > projects > ldc
comparison gen/toir.cpp @ 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 | 7f6eeb7b003e |
children | a69941a2c470 |
comparison
equal
deleted
inserted
replaced
912:16264a3973bf | 913:29c0d1194033 |
---|---|
177 DtoForceDeclareDsymbol(fdecl); | 177 DtoForceDeclareDsymbol(fdecl); |
178 func = fdecl->ir.irFunc->func; | 178 func = fdecl->ir.irFunc->func; |
179 } | 179 } |
180 return new DFuncValue(fdecl, func); | 180 return new DFuncValue(fdecl, func); |
181 } | 181 } |
182 else if (SymbolDeclaration* sdecl = var->isSymbolDeclaration()) | 182 else if (StaticStructInitDeclaration* sdecl = var->isStaticStructInitDeclaration()) |
183 { | 183 { |
184 // this seems to be the static initialiser for structs | 184 // this seems to be the static initialiser for structs |
185 Type* sdecltype = sdecl->type->toBasetype(); | 185 Type* sdecltype = sdecl->type->toBasetype(); |
186 Logger::print("Sym: type=%s\n", sdecltype->toChars()); | 186 Logger::print("Sym: type=%s\n", sdecltype->toChars()); |
187 assert(sdecltype->ty == Tstruct); | 187 assert(sdecltype->ty == Tstruct); |
203 | 203 |
204 LLConstant* VarExp::toConstElem(IRState* p) | 204 LLConstant* VarExp::toConstElem(IRState* p) |
205 { | 205 { |
206 Logger::print("VarExp::toConstElem: %s | %s\n", toChars(), type->toChars()); | 206 Logger::print("VarExp::toConstElem: %s | %s\n", toChars(), type->toChars()); |
207 LOG_SCOPE; | 207 LOG_SCOPE; |
208 if (SymbolDeclaration* sdecl = var->isSymbolDeclaration()) | 208 if (StaticStructInitDeclaration* sdecl = var->isStaticStructInitDeclaration()) |
209 { | 209 { |
210 // this seems to be the static initialiser for structs | 210 // this seems to be the static initialiser for structs |
211 Type* sdecltype = sdecl->type->toBasetype(); | 211 Type* sdecltype = sdecl->type->toBasetype(); |
212 Logger::print("Sym: type=%s\n", sdecltype->toChars()); | 212 Logger::print("Sym: type=%s\n", sdecltype->toChars()); |
213 assert(sdecltype->ty == Tstruct); | 213 assert(sdecltype->ty == Tstruct); |