Mercurial > projects > ddmd
diff dmd/EnumMember.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 | 2e2a5c3f943a |
line wrap: on
line diff
--- a/dmd/EnumMember.d Tue Apr 06 02:21:04 2010 +0100 +++ b/dmd/EnumMember.d Wed Apr 07 00:29:13 2010 +0100 @@ -11,42 +11,67 @@ class EnumMember : Dsymbol { - Expression value; - Type type; + Expression value; + Type type; - this(Loc loc, Identifier id, Expression value, Type type) + this(Loc loc, Identifier id, Expression value, Type type) { super(id); - + this.value = value; this.type = type; this.loc = loc; } - - Dsymbol syntaxCopy(Dsymbol s) + + Dsymbol syntaxCopy(Dsymbol s) { - assert(false); + Expression e = null; + if (value) + e = value.syntaxCopy(); + + Type t = null; + if (type) + t = type.syntaxCopy(); + + EnumMember em; + if (s) + { em = cast(EnumMember)s; + em.loc = loc; + em.value = e; + em.type = t; + } + else + em = new EnumMember(loc, ident, e, t); + return em; } - - void toCBuffer(OutBuffer buf, HdrGenState* hgs) + + void toCBuffer(OutBuffer buf, HdrGenState* hgs) { - assert(false); + if (type) + type.toCBuffer(buf, ident, hgs); + else + buf.writestring(ident.toChars()); + if (value) + { + buf.writestring(" = "); + value.toCBuffer(buf, hgs); + } } - - string kind() + + string kind() + { + return "enum member"; + } + + void emitComment(Scope sc) { assert(false); } - void emitComment(Scope sc) - { - assert(false); - } - - void toDocBuffer(OutBuffer buf) + void toDocBuffer(OutBuffer buf) { assert(false); } - EnumMember isEnumMember() { return this; } -} \ No newline at end of file + EnumMember isEnumMember() { return this; } +}