summaryrefslogtreecommitdiff
path: root/src/lib/eolian
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@samsung.com>2019-09-04 18:05:49 +0200
committerDaniel Kolesa <d.kolesa@samsung.com>2019-09-04 18:26:13 +0200
commit917b5feb27d491801495962226e38a0c171daeef (patch)
tree4de0f64e88252859ee1c61a0a7e77dad1270df28 /src/lib/eolian
parent6751f011c1c621c67b671baa4d63e887af374bd4 (diff)
eolian: make sure to include by_ref in validation of expressions
Diffstat (limited to 'src/lib/eolian')
-rw-r--r--src/lib/eolian/database_validate.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/lib/eolian/database_validate.c b/src/lib/eolian/database_validate.c
index a8e270c640..82b176163d 100644
--- a/src/lib/eolian/database_validate.c
+++ b/src/lib/eolian/database_validate.c
@@ -109,7 +109,8 @@ static Eina_Bool _validate_type_by_ref(Validate_State *vals, Eolian_Type *tp,
109 Eina_Bool by_ref, Eina_Bool move); 109 Eina_Bool by_ref, Eina_Bool move);
110static Eina_Bool _validate_expr(Eolian_Expression *expr, 110static Eina_Bool _validate_expr(Eolian_Expression *expr,
111 const Eolian_Type *tp, 111 const Eolian_Type *tp,
112 Eolian_Expression_Mask msk); 112 Eolian_Expression_Mask msk,
113 Eina_Bool by_ref);
113static Eina_Bool _validate_function(Validate_State *vals, 114static Eina_Bool _validate_function(Validate_State *vals,
114 Eolian_Function *func, 115 Eolian_Function *func,
115 Eina_Hash *nhash); 116 Eina_Hash *nhash);
@@ -139,7 +140,7 @@ _ef_map_cb(const Eina_Hash *hash EINA_UNUSED, const void *key EINA_UNUSED,
139 const Eolian_Enum_Type_Field *ef, Cb_Ret *sc) 140 const Eolian_Enum_Type_Field *ef, Cb_Ret *sc)
140{ 141{
141 if (ef->value) 142 if (ef->value)
142 sc->succ = _validate_expr(ef->value, NULL, EOLIAN_MASK_INT); 143 sc->succ = _validate_expr(ef->value, NULL, EOLIAN_MASK_INT, EINA_FALSE);
143 else 144 else
144 sc->succ = EINA_TRUE; 145 sc->succ = EINA_TRUE;
145 146
@@ -400,10 +401,12 @@ _validate_type(Validate_State *vals, Eolian_Type *tp)
400 401
401static Eina_Bool 402static Eina_Bool
402_validate_expr(Eolian_Expression *expr, const Eolian_Type *tp, 403_validate_expr(Eolian_Expression *expr, const Eolian_Type *tp,
403 Eolian_Expression_Mask msk) 404 Eolian_Expression_Mask msk, Eina_Bool by_ref)
404{ 405{
405 Eolian_Value val; 406 Eolian_Value val;
406 if (tp) 407 if (by_ref)
408 val = database_expr_eval(expr->base.unit, expr, EOLIAN_MASK_NULL, NULL, NULL);
409 else if (tp)
407 val = database_expr_eval_type(expr->base.unit, expr, tp, NULL, NULL); 410 val = database_expr_eval_type(expr->base.unit, expr, tp, NULL, NULL);
408 else 411 else
409 val = database_expr_eval(expr->base.unit, expr, msk, NULL, NULL); 412 val = database_expr_eval(expr->base.unit, expr, msk, NULL, NULL);
@@ -420,7 +423,7 @@ _validate_param(Validate_State *vals, Eolian_Function_Parameter *param)
420 if (!_validate_type_by_ref(vals, param->type, param->by_ref, param->move)) 423 if (!_validate_type_by_ref(vals, param->type, param->by_ref, param->move))
421 return EINA_FALSE; 424 return EINA_FALSE;
422 425
423 if (param->value && !_validate_expr(param->value, param->type, 0)) 426 if (param->value && !_validate_expr(param->value, param->type, 0, param->by_ref))
424 return EINA_FALSE; 427 return EINA_FALSE;
425 428
426 if (!_validate_doc(param->doc)) 429 if (!_validate_doc(param->doc))
@@ -468,11 +471,13 @@ _validate_function(Validate_State *vals, Eolian_Function *func, Eina_Hash *nhash
468 return _reset_stable(vals, was_stable, EINA_FALSE); 471 return _reset_stable(vals, was_stable, EINA_FALSE);
469 472
470 if (func->get_ret_val && !_validate_expr(func->get_ret_val, 473 if (func->get_ret_val && !_validate_expr(func->get_ret_val,
471 func->get_ret_type, 0)) 474 func->get_ret_type, 0,
475 func->get_return_by_ref))
472 return _reset_stable(vals, was_stable, EINA_FALSE); 476 return _reset_stable(vals, was_stable, EINA_FALSE);
473 477
474 if (func->set_ret_val && !_validate_expr(func->set_ret_val, 478 if (func->set_ret_val && !_validate_expr(func->set_ret_val,
475 func->set_ret_type, 0)) 479 func->set_ret_type, 0,
480 func->set_return_by_ref))
476 return _reset_stable(vals, was_stable, EINA_FALSE); 481 return _reset_stable(vals, was_stable, EINA_FALSE);
477 482
478#define EOLIAN_PARAMS_VALIDATE(params) \ 483#define EOLIAN_PARAMS_VALIDATE(params) \
@@ -1434,7 +1439,7 @@ _validate_variable(Validate_State *vals, Eolian_Variable *var)
1434 if (!_validate_type(vals, var->base_type)) 1439 if (!_validate_type(vals, var->base_type))
1435 return _reset_stable(vals, was_stable, EINA_FALSE); 1440 return _reset_stable(vals, was_stable, EINA_FALSE);
1436 1441
1437 if (var->value && !_validate_expr(var->value, var->base_type, 0)) 1442 if (var->value && !_validate_expr(var->value, var->base_type, 0, EINA_FALSE))
1438 return _reset_stable(vals, was_stable, EINA_FALSE); 1443 return _reset_stable(vals, was_stable, EINA_FALSE);
1439 1444
1440 if (!_validate_doc(var->doc)) 1445 if (!_validate_doc(var->doc))