restrict removal of arg only to comma operator,

otherwise functions with a single variable may fail
This commit is contained in:
Holger Vogt 2020-03-22 11:59:28 +01:00
parent 4a3b193154
commit d3fcf2f43f
1 changed files with 4 additions and 1 deletions

View File

@ -307,7 +307,10 @@ struct pnode *PP_mkfnode(const char *func, struct pnode *arg)
/* Give the user-defined functions a try. */
q = ft_substdef(func, arg);
if (q) { /* found */
free_pnode(arg);
/* remove only the old comma operator pnode, no longer used */
if (arg->pn_op && arg->pn_op->op_num == PT_OP_COMMA) {
free_pnode(arg);
}
return q;
}
}