comparison gen/statements.cpp @ 733:cc8ba72c0350

Nested access to with statement should work now. fixes #105
author Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
date Mon, 27 Oct 2008 01:40:47 +0100
parents 30b42a283c8e
children 5761d7e6f628
comparison
equal deleted inserted replaced
732:6aeaef263289 733:cc8ba72c0350
1153 assert(exp); 1153 assert(exp);
1154 assert(body); 1154 assert(body);
1155 1155
1156 DValue* e = exp->toElem(p); 1156 DValue* e = exp->toElem(p);
1157 1157
1158 #if 1 1158 if (wthis->ir.isSet())
1159 // this doesn't handle the mini/with2.d test case ... 1159 {
1160 assert(!wthis->ir.isSet()); 1160 assert(wthis->nestedref);
1161 wthis->ir.irLocal = new IrLocal(wthis); 1161 assert(wthis->ir.irLocal);
1162 wthis->ir.irLocal->value = DtoAlloca(DtoType(wthis->type), wthis->toChars()); 1162 assert(!wthis->ir.irLocal->value);
1163 #else 1163 wthis->ir.irLocal->value = DtoAlloca(DtoType(wthis->type), wthis->toChars());
1164 // ... this does, but it also silently breaks MiniD!!! 1164
1165 DtoDeclarationExp(wthis); 1165 // store the address into the nested vars array
1166 #endif 1166 assert(wthis->ir.irLocal->nestedIndex >= 0);
1167 LLValue* gep = DtoGEPi(gIR->func()->decl->ir.irFunc->nestedVar, 0, wthis->ir.irLocal->nestedIndex);
1168 assert(isaPointer(wthis->ir.irLocal->value));
1169 LLValue* val = DtoBitCast(wthis->ir.irLocal->value, getVoidPtrType());
1170 DtoStore(val, gep);
1171 }
1172 else
1173 {
1174 assert(!wthis->nestedref);
1175 wthis->ir.irLocal = new IrLocal(wthis);
1176 wthis->ir.irLocal->value = DtoAlloca(DtoType(wthis->type), wthis->toChars());
1177 }
1167 1178
1168 DtoStore(e->getRVal(), wthis->ir.irLocal->value); 1179 DtoStore(e->getRVal(), wthis->ir.irLocal->value);
1169 1180
1170 body->toIR(p); 1181 body->toIR(p);
1171 } 1182 }