# HG changeset patch # User Frits van Bommel # Date 1243812498 -7200 # Node ID 301a916eceefeef54b993072ea7f5c2c404e7656 # Parent e92e14690a4f95a9f311c08bb835ae7924f8603b Remove redundant null-check in member functions of structs that don't have an invariant. diff -r e92e14690a4f -r 301a916eceef dmd/func.c --- a/dmd/func.c Sun May 31 11:20:26 2009 -0600 +++ b/dmd/func.c Mon Jun 01 01:28:18 2009 +0200 @@ -1266,12 +1266,17 @@ } else { // Call invariant virtually - ThisExp *v = new ThisExp(0); - v->type = vthis->type; - e = new AssertExp(loc, v, NULL); + // LDC: unless this is a struct without invariant + StructDeclaration* sd = ad->isStructDeclaration(); + if (!sd || sd->inv) + { + ThisExp *v = new ThisExp(0); + v->type = vthis->type; + e = new AssertExp(loc, v, NULL); + } // LDC: check for null this - v = new ThisExp(0); + ThisExp* v = new ThisExp(0); v->type = vthis->type; v->var = vthis;