On Wed, 03 Sep 2014 15:20:55 +0000 via Digitalmars-d <[email protected]> wrote:
> Unfortunately I don't understand DMD's internals enough to finish
> it
i'm pretty sure that this can be done with a little hack in
parseExpression(): just append 'cast(void)0' to the list of expressions
there.
something like this:
Expression *Parser::parseExpression(bool allowCommas)
{
Expression *e;
Expression *e2;
Loc loc = token.loc;
bool addVoid = false;
//printf("Parser::parseExpression() loc = %d\n", loc.linnum);
e = parseAssignExp();
while (token.value == TOKcomma)
{
if (!allowCommas)
{
warning(token.loc, "commas in expression are deprecated");
addVoid = true;
}
nextToken();
e2 = parseAssignExp();
e = new CommaExp(loc, e, e2);
loc = token.loc;
}
if (addVoid) e = new CommaExp(loc, e, new CastExp(loc, new
IntegerExp(loc, 0, Type::tint32), Type::tvoid));
return e;
}
no need to introduce new types and hack semantic analyzer. ;-)
signature.asc
Description: PGP signature
