Merged DMD commit fe063f92ec667d0a8d4e2ab4659919df4360d7e8:

bugzilla 4864 ICE(statement.c) Crash on invalid 'if statement' body inside mixin
This commit is contained in:
David Nadlinger
2011-04-22 18:45:00 +02:00
parent af7559f65c
commit 90cb596e14
2 changed files with 6 additions and 2 deletions

View File

@@ -3181,7 +3181,10 @@ Statement *Parser::parseStatement(int flags)
}
else
elsebody = NULL;
s = new IfStatement(loc, arg, condition, ifbody, elsebody);
if (condition && ifbody)
s = new IfStatement(loc, arg, condition, ifbody, elsebody);
else
s = NULL; // don't propagate parsing errors
break;
}

View File

@@ -339,7 +339,8 @@ Statements *CompileStatement::flatten(Scope *sc)
while (p.token.value != TOKeof)
{
Statement *s = p.parseStatement(PSsemi | PScurlyscope);
a->push(s);
if (s) // if no parsing errors
a->push(s);
}
return a;
}