| 235 |
|
*ep = *ep1; |
| 236 |
|
efree(ep1); /* not epfree()! */ |
| 237 |
|
} |
| 238 |
< |
if ((epar->nkids <= 2) | !(esupport & E_RCONST)) |
| 238 |
> |
if (!(esupport & E_RCONST)) |
| 239 |
|
return; |
| 240 |
|
ep1 = NULL; /* combine constants in sum/product */ |
| 241 |
|
for (ep = epar->v.kid; ep != NULL; ep = ep->sibling) |
| 246 |
|
} |
| 247 |
|
if (ep1 == NULL) |
| 248 |
|
return; |
| 249 |
< |
ep1->v.num = combined; /* drop following constants */ |
| 249 |
> |
ep1->v.num = combined; /* assumes commutative property, also */ |
| 250 |
|
while (ep1->sibling != NULL) |
| 251 |
|
if (ep1->sibling->type == NUM) { |
| 252 |
|
ep = ep1->sibling; |
| 253 |
|
ep1->sibling = ep->sibling; |
| 254 |
< |
efree(ep); |
| 254 |
> |
epar->nkids--; |
| 255 |
> |
efree(ep); /* drop subsumed constant */ |
| 256 |
|
} else |
| 257 |
|
ep1 = ep1->sibling; |
| 258 |
+ |
|
| 259 |
+ |
if (epar->nkids == 1) { /* late constant expression? */ |
| 260 |
+ |
ep = epar->v.kid; |
| 261 |
+ |
*epar = *ep; |
| 262 |
+ |
efree(ep); |
| 263 |
+ |
} |
| 264 |
|
} |
| 265 |
|
|
| 266 |
|
|