mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-02-03 05:23:14 +01:00
Remove redundant null-check in member functions of structs that don't have an
invariant.
This commit is contained in:
13
dmd/func.c
13
dmd/func.c
@@ -1266,12 +1266,17 @@ void FuncDeclaration::semantic3(Scope *sc)
|
||||
}
|
||||
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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user