Mercurial > projects > ddmd
diff dmd/CtorDeclaration.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/CtorDeclaration.d Sun Oct 17 07:42:00 2010 +0400 +++ b/dmd/CtorDeclaration.d Sun Oct 17 20:56:07 2010 +0400 @@ -53,19 +53,14 @@ override void semantic(Scope sc) { - AggregateDeclaration ad; - Type tret; - //printf("CtorDeclaration.semantic() %s\n", toChars()); - if (type) - return; - sc = sc.push(); sc.stc &= ~STCstatic; // not a static constructor parent = sc.parent; Dsymbol parent = toParent2(); - ad = parent.isAggregateDeclaration(); + Type tret; + AggregateDeclaration ad = parent.isAggregateDeclaration(); if (!ad || parent.isUnionDeclaration()) { error("constructors are only for class or struct definitions"); @@ -76,7 +71,8 @@ tret = ad.handle; assert(tret); } - type = new TypeFunction(arguments, tret, varargs, LINKd); + if (!type) + type = new TypeFunction(arguments, tret, varargs, LINKd); version (STRUCTTHISREF) { if (ad && ad.isStructDeclaration()) @@ -92,7 +88,7 @@ // Append: // return this; // to the function body - if (fbody) + if (fbody && semanticRun < PASSsemantic) { Expression e = new ThisExp(loc); Statement s = new ReturnStatement(loc, e);