Mercurial > projects > ldc
changeset 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 | e92e14690a4f |
children | 83bdf7bed9c5 89e38fbfef1f |
files | dmd/func.c |
diffstat | 1 files changed, 9 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- 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;