[template-glib] expr-parser.y: allow creating functions without a name
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [template-glib] expr-parser.y: allow creating functions without a name
- Date: Thu, 5 May 2022 00:51:50 +0000 (UTC)
commit b8247680f02f4bb4a04a0782a2207f9d0f7af530
Author: Christian Hergert <chergert redhat com>
Date: Wed May 4 17:45:41 2022 -0700
expr-parser.y: allow creating functions without a name
This allows creating a new function which does not have a name even though
we can't call them yet.
src/tmpl-expr-parser.y | 6 ++++++
src/tmpl-expr.c | 2 --
2 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/src/tmpl-expr-parser.y b/src/tmpl-expr-parser.y
index f3b2a58..d8f47af 100644
--- a/src/tmpl-expr-parser.y
+++ b/src/tmpl-expr-parser.y
@@ -300,6 +300,12 @@ exp: exp CMP exp {
g_free ($2);
g_free ($4);
}
+ | FUNC '(' ')' stmt {
+ $$ = create_function (NULL, NULL, $4);
+ }
+ | FUNC '(' symlist ')' stmt {
+ $$ = create_function (NULL, $3, $5);
+ }
;
explist: exp
diff --git a/src/tmpl-expr.c b/src/tmpl-expr.c
index 25def26..d5a1422 100644
--- a/src/tmpl-expr.c
+++ b/src/tmpl-expr.c
@@ -401,8 +401,6 @@ tmpl_expr_new_func (char *name,
{
TmplExprFunc *ret;
- g_return_val_if_fail (name != NULL, NULL);
-
if (list == NULL)
list = tmpl_expr_new_nop ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]