summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/expression.h1
-rw-r--r--src/expression.c12
2 files changed, 13 insertions, 0 deletions
diff --git a/include/expression.h b/include/expression.h
index 717b6755..d502fc2a 100644
--- a/include/expression.h
+++ b/include/expression.h
@@ -169,6 +169,7 @@ struct expr_ops {
};
const struct expr_ops *expr_ops(const struct expr *e);
+const struct expr_ops *expr_ops_by_type(enum expr_types etype);
/**
* enum expr_flags
diff --git a/src/expression.c b/src/expression.c
index 6fa2f1dd..a7bbde7e 100644
--- a/src/expression.c
+++ b/src/expression.c
@@ -1222,3 +1222,15 @@ const struct expr_ops *expr_ops(const struct expr *e)
BUG("Unknown expression type %d\n", e->etype);
}
+
+const struct expr_ops *expr_ops_by_type(enum expr_types etype)
+{
+ switch (etype) {
+ case EXPR_PAYLOAD:
+ return &payload_expr_ops;
+ default:
+ break;
+ }
+
+ BUG("Unknown expression type %d\n", etype);
+}