static Eina_Bool
_validate_type(const Eolian_Type *tp)
{
+ char buf[256];
+
+ if ((tp->is_own || tp->freefunc) && !database_type_is_ownable(tp))
+ {
+ snprintf(buf, sizeof(buf), "type '%s' is not ownable", tp->full_name);
+ return _type_error(tp, buf);
+ }
+
switch (tp->type)
{
case EOLIAN_TYPE_VOID:
tpp = eolian_type_typedecl_get(tp);
if (!tpp)
{
- char buf[256];
snprintf(buf, sizeof(buf), "undefined type %s", tp->full_name);
return _type_error(tp, buf);
}
/* FIXME: pass unit properly */
if (!eolian_type_class_get(NULL, tp))
{
- char buf[256];
snprintf(buf, sizeof(buf), "undefined class %s "
"(likely wrong namespacing)", tp->full_name);
return _type_error(tp, buf);
pline = ls->line_number;
pcolumn = ls->column;
check_next(ls, '(');
- eo_lexer_context_push(ls);
def = parse_type_void(ls, allow_ref, EINA_FALSE);
- if (!database_type_is_ownable(def))
- {
- eo_lexer_context_restore(ls);
- eo_lexer_syntax_error(ls, "ownable type expected");
- }
- eo_lexer_context_pop(ls);
FILL_BASE(def->base, ls, line, col);
def->is_own = EINA_TRUE;
check_match(ls, ')', '(', pline, pcolumn);
pline = ls->line_number;
pcolumn = ls->column;
check_next(ls, '(');
- eo_lexer_context_push(ls);
def = parse_type_void(ls, allow_ref, EINA_FALSE);
- if (!database_type_is_ownable(def))
- {
- eo_lexer_context_restore(ls);
- eo_lexer_syntax_error(ls, "freeable type expected");
- }
- eo_lexer_context_pop(ls);
check_next(ls, ',');
check(ls, TOK_VALUE);
def->freefunc = eina_stringshare_ref(ls->t.value.s);