comparison dmd/InvariantDeclaration.d @ 179:cd48cb899aee

Updated to dmd2.040
author korDen
date Sun, 17 Oct 2010 20:56:07 +0400
parents e3afd1303184
children b0d41ff5e0df
comparison
equal deleted inserted replaced
178:e3afd1303184 179:cd48cb899aee
30 return id; 30 return id;
31 } 31 }
32 32
33 override void semantic(Scope sc) 33 override void semantic(Scope sc)
34 { 34 {
35 AggregateDeclaration ad;
36 Type tret;
37
38 parent = sc.parent; 35 parent = sc.parent;
39 Dsymbol parent = toParent(); 36 Dsymbol parent = toParent();
40 ad = parent.isAggregateDeclaration(); 37 AggregateDeclaration ad = parent.isAggregateDeclaration();
41 if (!ad) 38 if (!ad)
42 { 39 {
43 error("invariants are only for struct/union/class definitions"); 40 error("invariants are only for struct/union/class definitions");
44 return; 41 return;
45 } 42 }
46 else if (ad.inv && ad.inv != this) 43 else if (ad.inv && ad.inv != this && semanticRun < PASSsemantic)
47 { 44 {
48 error("more than one invariant for %s", ad.toChars()); 45 error("more than one invariant for %s", ad.toChars());
49 } 46 }
50 ad.inv = this; 47 ad.inv = this;
51 type = new TypeFunction(null, Type.tvoid, false, LINKd); 48 if (!type)
49 type = new TypeFunction(null, Type.tvoid, false, LINKd);
52 50
53 sc = sc.push(); 51 sc = sc.push();
54 sc.stc &= ~STCstatic; // not a static invariant 52 sc.stc &= ~STCstatic; // not a static invariant
55 sc.incontract++; 53 sc.incontract++;
56 sc.linkage = LINK.LINKd; 54 sc.linkage = LINK.LINKd;