eolian: handle pointer types in typechecking expr eval

Also improve expr error messages and fix Eolian tests.
This commit is contained in:
Daniel Kolesa 2016-12-14 18:14:10 +01:00
parent ca50a4de4c
commit e444d43bbb
3 changed files with 8 additions and 6 deletions

View File

@ -50,7 +50,7 @@ mask_to_str(int mask, char *buf)
}
static Eina_Bool
expr_type_error(const Eolian_Expression *expr, int mask, int type)
expr_type_error(const Eolian_Expression *expr, int type, int mask)
{
char buf[512];
char ebuf[256];
@ -153,9 +153,9 @@ promote(Eolian_Expression *a, Eolian_Expression *b)
assert(a->type && b->type);
/* not a number */
if (a->type >= EOLIAN_EXPR_STRING)
return expr_type_error(a, EOLIAN_MASK_NUMBER, expr_type_to_mask(a));
return expr_type_error(a, expr_type_to_mask(a), EOLIAN_MASK_NUMBER);
if (b->type >= EOLIAN_EXPR_STRING)
return expr_type_error(b, EOLIAN_MASK_NUMBER, expr_type_to_mask(b));
return expr_type_error(b, expr_type_to_mask(b), EOLIAN_MASK_NUMBER);
/* no need for promotion */
if (a->type == b->type) return EINA_TRUE;
/* if either operand is floating point, everything has to be */

View File

@ -29,6 +29,8 @@ _eval_type(const Eolian_Expression *expr, const Eolian_Type *type)
case EOLIAN_TYPE_REGULAR:
{
int kw = eo_lexer_keyword_str_to_id(type->name);
if (type->is_ptr)
return database_expr_eval(expr, EOLIAN_MASK_NULL);
if (!kw || kw < KW_byte || kw >= KW_void)
{
const Eolian_Typedecl *base = eolian_type_typedecl_get(type);

View File

@ -2,7 +2,7 @@ EWAPI float BAR = 10.300000f;
Eina_Bool _class_simple_a_set(Eo *obj, Evas_Simple_Data *pd, int value);
EOAPI EFL_FUNC_BODYV(efl_canvas_object_simple_a_set, Eina_Bool, EINA_TRUE, EFL_FUNC_CALL(value), int value);
EOAPI EFL_FUNC_BODYV(efl_canvas_object_simple_a_set, Eina_Bool, EINA_TRUE /* true */, EFL_FUNC_CALL(value), int value);
int _class_simple_a_get(Eo *obj, Evas_Simple_Data *pd);
@ -20,11 +20,11 @@ static char *__eolian_class_simple_foo(Eo *obj, Evas_Simple_Data *pd, int a, cha
return _class_simple_foo(obj, pd, a, b, c, d);
}
EOAPI EFL_FUNC_BODYV(efl_canvas_object_simple_foo, char *, NULL, EFL_FUNC_CALL(a, b, c, d), int a, char *b, double *c, int *d);
EOAPI EFL_FUNC_BODYV(efl_canvas_object_simple_foo, char *, NULL /* null */, EFL_FUNC_CALL(a, b, c, d), int a, char *b, double *c, int *d);
int *_class_simple_bar(Eo *obj, Evas_Simple_Data *pd, int x);
EOAPI EFL_FUNC_BODYV(efl_canvas_object_simple_bar, int *, 0, EFL_FUNC_CALL(x), int x);
EOAPI EFL_FUNC_BODYV(efl_canvas_object_simple_bar, int *, NULL, EFL_FUNC_CALL(x), int x);
static Eina_Bool
_class_simple_class_initializer(Efl_Class *klass)