Mercurial > projects > ddmd
diff dmd/StaticAssert.d @ 20:1628b221808d
Fleshed out more unimplemented methods.
author | Robert Clipsham <robert@octarineparrot.com> |
---|---|
date | Wed, 07 Apr 2010 00:29:13 +0100 |
parents | 10317f0c89a5 |
children | 460959608115 |
line wrap: on
line diff
--- a/dmd/StaticAssert.d Tue Apr 06 02:21:04 2010 +0100 +++ b/dmd/StaticAssert.d Wed Apr 07 00:29:13 2010 +0100 @@ -14,33 +14,37 @@ class StaticAssert : Dsymbol { - Expression exp; - Expression msg; + Expression exp; + Expression msg; - this(Loc loc, Expression exp, Expression msg) + this(Loc loc, Expression exp, Expression msg) { super(Id.empty); - + this.loc = loc; this.exp = exp; this.msg = msg; } - Dsymbol syntaxCopy(Dsymbol s) + Dsymbol syntaxCopy(Dsymbol s) { - assert(false); + StaticAssert sa; + + assert(!s); + sa = new StaticAssert(loc, exp.syntaxCopy(), msg ? msg.syntaxCopy() : null); + return sa; } - - bool addMember(Scope sc, ScopeDsymbol sd, int memnum) + + bool addMember(Scope sc, ScopeDsymbol sd, int memnum) { return false; // we didn't add anything } - - void semantic(Scope sc) + + void semantic(Scope sc) { } - - void semantic2(Scope sc) + + void semantic2(Scope sc) { Expression e; @@ -75,29 +79,38 @@ error("(%s) is not evaluatable at compile time", exp.toChars()); } } - - void inlineScan() + + void inlineScan() { - assert(false); } - - bool oneMember(Dsymbol* ps) + + bool oneMember(Dsymbol* ps) { - assert(false); + //printf("StaticAssert::oneMember())\n"); + *ps = null; + return true; } - - void toObjFile(int multiobj) + + void toObjFile(int multiobj) { - assert(false); } - - string kind() + + string kind() { return "static assert"; } - - void toCBuffer(OutBuffer buf, HdrGenState* hgs) + + void toCBuffer(OutBuffer buf, HdrGenState* hgs) { - assert(false); + buf.writestring(kind()); + buf.writeByte('('); + exp.toCBuffer(buf, hgs); + if (msg) + { + buf.writeByte(','); + msg.toCBuffer(buf, hgs); + } + buf.writestring(");"); + buf.writenl(); } -} \ No newline at end of file +}