ast: simplify AppendStmt

Signed-off-by: Ran Benita <ran234@gmail.com>
master
Ran Benita 2012-10-11 21:50:21 +02:00
parent bbf388ec1f
commit 89523789ca
1 changed files with 9 additions and 13 deletions

View File

@ -70,19 +70,15 @@ malloc_or_die(size_t size)
ParseCommon *
AppendStmt(ParseCommon *to, ParseCommon *append)
{
ParseCommon *start = to;
ParseCommon *iter;
if (append == NULL)
return to;
while ((to != NULL) && (to->next != NULL))
{
to = to->next;
}
if (to) {
to->next = append;
return start;
}
if (!to)
return append;
for (iter = to; iter->next; iter = iter->next);
iter->next = append;
return to;
}
ExprDef *