summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 7d146c2)
raw | patch | inline | side by side (parent: 7d146c2)
author | Sebastian Harl <sh@tokkee.org> | |
Fri, 27 Feb 2015 18:22:35 +0000 (19:22 +0100) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Fri, 27 Feb 2015 18:22:35 +0000 (19:22 +0100) |
src/frontend/analyzer.c | patch | blob | history |
index 607015c233ce15cd4df4129b32024b95e7c735e1..75aa94d1579da92f8f9e25b3ee03c74273d70b74 100644 (file)
--- a/src/frontend/analyzer.c
+++ b/src/frontend/analyzer.c
SDB_TYPE_TO_STRING(right));
} /* cmp_error */
+static void
+op_error(sdb_strbuf_t *errbuf, int op, int left, int right)
+{
+ sdb_strbuf_sprintf(errbuf, "Invalid operator %s for types %s and %s",
+ SDB_DATA_OP_TO_STRING(op), SDB_TYPE_TO_STRING(left),
+ SDB_TYPE_TO_STRING(right));
+} /* cmp_error */
+
static int
analyze_expr(int context, sdb_store_expr_t *e, sdb_strbuf_t *errbuf)
{
return -1;
if (analyze_expr(context, e->right, errbuf))
return -1;
+
+ if ((e->left->data_type > 0) && (e->right->data_type > 0)) {
+ if (sdb_data_expr_type(e->type, e->left->data_type,
+ e->right->data_type) < 0) {
+ op_error(errbuf, e->type, e->left->data_type,
+ e->right->data_type);
+ return -1;
+ }
+ }
break;
}
return 0;