# HG changeset patch # User korDen # Date 1282517285 -14400 # Node ID a8740d0dbea478a863c8a84198169cd85d8c1948 # Parent 35afd92948549a3c8fe0ae34b9e40c9f2da08451 TypeTypeof.toCBuffer2 BinExp.semanticp bug fixed diff -r 35afd9294854 -r a8740d0dbea4 dmd/BinExp.d --- a/dmd/BinExp.d Sat Aug 21 14:54:46 2010 +0400 +++ b/dmd/BinExp.d Mon Aug 23 02:48:05 2010 +0400 @@ -78,7 +78,7 @@ int typeMerge(Scope sc, Expression e, Type* pt, Expression* pe1, Expression* pe2) { - //printf("typeMerge() %s op %s\n", (*pe1).toChars(), (*pe2).toChars()); + //printf("typeMerge() %.*s op %.*s\n", (*pe1).toChars(), (*pe2).toChars()); //dump(0); Expression e1 = (*pe1).integralPromotions(sc); @@ -385,7 +385,7 @@ Expression semantic(Scope sc) { version (LOGSEMANTIC) { - printf("BinExp.semantic('%s')\n", toChars()); + printf("BinExp.semantic('%.*s')\n", toChars()); } e1 = e1.semantic(sc); if (!e1.type && !(op == TOK.TOKassign && e1.op == TOK.TOKdottd)) // a.template = e2 @@ -404,22 +404,10 @@ Expression semanticp(Scope sc) { -version (LOGSEMANTIC) { - printf("BinExp.semantic('%s')\n", toChars()); -} - e1 = e1.semantic(sc); - if (!e1.type && - !(op == TOK.TOKassign && e1.op == TOK.TOKdottd)) // a.template = e2 - { - error("%s has no value", e1.toChars()); - e1.type = Type.terror; - } - e2 = e2.semantic(sc); - if (!e2.type) - { - error("%s has no value", e2.toChars()); - e2.type = Type.terror; - } + BinExp.semantic(sc); + + e1 = resolveProperties(sc, e1); + e2 = resolveProperties(sc, e2); return this; } diff -r 35afd9294854 -r a8740d0dbea4 dmd/TypeTypeof.d --- a/dmd/TypeTypeof.d Sat Aug 21 14:54:46 2010 +0400 +++ b/dmd/TypeTypeof.d Mon Aug 23 02:48:05 2010 +0400 @@ -54,7 +54,15 @@ void toCBuffer2(OutBuffer buf, HdrGenState* hgs, MOD mod) { - assert(false); + if (mod != this.mod) + { + toCBuffer3(buf, hgs, mod); + return; + } + buf.writestring("typeof("); + exp.toCBuffer(buf, hgs); + buf.writeByte(')'); + toCBuffer2Helper(buf, hgs); } Type semantic(Loc loc, Scope sc) @@ -62,7 +70,7 @@ Expression e; Type t; - //printf("TypeTypeof.semantic() %p\n", this); + //printf("TypeTypeof.semantic() %.*s\n", toChars()); //static int nest; if (++nest == 50) *(char*)0=0;