Mercurial > projects > ddmd
diff dmd/InvariantDeclaration.d @ 179:cd48cb899aee
Updated to dmd2.040
author | korDen |
---|---|
date | Sun, 17 Oct 2010 20:56:07 +0400 |
parents | e3afd1303184 |
children | b0d41ff5e0df |
line wrap: on
line diff
--- a/dmd/InvariantDeclaration.d Sun Oct 17 07:42:00 2010 +0400 +++ b/dmd/InvariantDeclaration.d Sun Oct 17 20:56:07 2010 +0400 @@ -32,23 +32,21 @@ override void semantic(Scope sc) { - AggregateDeclaration ad; - Type tret; - parent = sc.parent; Dsymbol parent = toParent(); - ad = parent.isAggregateDeclaration(); + AggregateDeclaration ad = parent.isAggregateDeclaration(); if (!ad) { error("invariants are only for struct/union/class definitions"); return; } - else if (ad.inv && ad.inv != this) + else if (ad.inv && ad.inv != this && semanticRun < PASSsemantic) { error("more than one invariant for %s", ad.toChars()); } ad.inv = this; - type = new TypeFunction(null, Type.tvoid, false, LINKd); + if (!type) + type = new TypeFunction(null, Type.tvoid, false, LINKd); sc = sc.push(); sc.stc &= ~STCstatic; // not a static invariant