From 55104ac430bed00caf6b5a9fb9c0861ca2eecb68 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Tue, 9 Feb 2021 19:30:30 +0900 Subject: [PATCH] [util] Allow "any type" results for cexpr Setting the result type cexpr_exprval tells cexpr to simply return whoe exprval object rather than the referenced value, thus allowing the caller to check the type when the expression is context sensitive. --- libs/util/cexpr-parse.y | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libs/util/cexpr-parse.y b/libs/util/cexpr-parse.y index 8ccf0b20b..ad734def7 100644 --- a/libs/util/cexpr-parse.y +++ b/libs/util/cexpr-parse.y @@ -191,6 +191,10 @@ assign_expr (exprval_t *dst, const exprval_t *src, exprctx_t *context) if (!src) { return; } + if (dst->type == &cexpr_exprval) { + *(exprval_t **) dst->value = (exprval_t *) src; + return; + } binop = cexpr_find_cast (dst->type, src->type); if (binop && binop->op) { binop->func (dst, src, dst, context);