comparison dmd/func.c @ 1449:301a916eceef

Remove redundant null-check in member functions of structs that don't have an invariant.
author Frits van Bommel <fvbommel wxs.nl>
date Mon, 01 Jun 2009 01:28:18 +0200
parents 8026319762be
children d9c5f5a43403
comparison
equal deleted inserted replaced
1448:e92e14690a4f 1449:301a916eceef
1264 e = e->semantic(sc2); 1264 e = e->semantic(sc2);
1265 } 1265 }
1266 } 1266 }
1267 else 1267 else
1268 { // Call invariant virtually 1268 { // Call invariant virtually
1269 ThisExp *v = new ThisExp(0); 1269 // LDC: unless this is a struct without invariant
1270 v->type = vthis->type; 1270 StructDeclaration* sd = ad->isStructDeclaration();
1271 e = new AssertExp(loc, v, NULL); 1271 if (!sd || sd->inv)
1272 {
1273 ThisExp *v = new ThisExp(0);
1274 v->type = vthis->type;
1275 e = new AssertExp(loc, v, NULL);
1276 }
1272 1277
1273 // LDC: check for null this 1278 // LDC: check for null this
1274 v = new ThisExp(0); 1279 ThisExp* v = new ThisExp(0);
1275 v->type = vthis->type; 1280 v->type = vthis->type;
1276 v->var = vthis; 1281 v->var = vthis;
1277 1282
1278 NullExp *nv = new NullExp(0); 1283 NullExp *nv = new NullExp(0);
1279 nv->type = v->type; 1284 nv->type = v->type;