comparison gen/llvmhelpers.cpp @ 648:8d850fa25713

Fix VarDecls for tuples. Closes #99. I've implemented it this way since it doesn't require any changes in the frontend. However, I think having TypeTuple expressed as LLVM struct types would make much more sense and open the door to tuple lvalues.
author Christian Kamm <kamm incasoftware de>
date Sun, 05 Oct 2008 11:47:47 +0200
parents 8aebdf56c455
children c42173b3557b
comparison
equal deleted inserted replaced
646:51c4d1a64da6 648:8d850fa25713
1126 1126
1127 // variable declaration 1127 // variable declaration
1128 if (VarDeclaration* vd = declaration->isVarDeclaration()) 1128 if (VarDeclaration* vd = declaration->isVarDeclaration())
1129 { 1129 {
1130 Logger::println("VarDeclaration"); 1130 Logger::println("VarDeclaration");
1131
1132 // if aliassym is set, this VarDecl is redone as an alias to another symbol
1133 // this seems to be done to rewrite Tuple!(...) v;
1134 // as a TupleDecl that contains a bunch of individual VarDecls
1135 if (vd->aliassym)
1136 return DtoDeclarationExp(vd->aliassym);
1131 1137
1132 // static 1138 // static
1133 if (vd->isDataseg()) 1139 if (vd->isDataseg())
1134 { 1140 {
1135 vd->toObjFile(0); // TODO: multiobj 1141 vd->toObjFile(0); // TODO: multiobj
1247 { 1253 {
1248 Dsymbol* mdsym = (Dsymbol*)m->members->data[i]; 1254 Dsymbol* mdsym = (Dsymbol*)m->members->data[i];
1249 DtoDeclarationExp(mdsym); 1255 DtoDeclarationExp(mdsym);
1250 } 1256 }
1251 } 1257 }
1258 // tuple declaration
1259 else if (TupleDeclaration* tupled = declaration->isTupleDeclaration())
1260 {
1261 Logger::println("TupleDeclaration");
1262 if(!tupled->isexp) {
1263 error(declaration->loc, "don't know how to handle non-expression tuple decls yet");
1264 assert(0);
1265 }
1266
1267 assert(tupled->objects);
1268 for (int i=0; i < tupled->objects->dim; ++i)
1269 {
1270 DsymbolExp* exp = (DsymbolExp*)tupled->objects->data[i];
1271 DtoDeclarationExp(exp->s);
1272 }
1273 }
1252 // unsupported declaration 1274 // unsupported declaration
1253 else 1275 else
1254 { 1276 {
1255 error(declaration->loc, "Unimplemented Declaration type for DeclarationExp. kind: %s", declaration->kind()); 1277 error(declaration->loc, "Unimplemented Declaration type for DeclarationExp. kind: %s", declaration->kind());
1256 assert(0); 1278 assert(0);