EINA_LIST_FOREACH(cl->inherits, l, icl)
{
+ /* first inherit needs some checking done on it */
+ if (l == cl->inherits) switch (cl->type)
+ {
+ case EOLIAN_CLASS_REGULAR:
+ case EOLIAN_CLASS_ABSTRACT:
+ if (icl->type != EOLIAN_CLASS_REGULAR && icl->type != EOLIAN_CLASS_ABSTRACT)
+ {
+ char buf[PATH_MAX];
+ snprintf(buf, sizeof(buf), "regular classes ('%s') cannot inherit from non-regular classes ('%s')",
+ cl->full_name, icl->full_name);
+ return _obj_error(&cl->base, buf);
+ }
+ break;
+ case EOLIAN_CLASS_MIXIN:
+ case EOLIAN_CLASS_INTERFACE:
+ if (icl->type != EOLIAN_CLASS_MIXIN && icl->type != EOLIAN_CLASS_INTERFACE)
+ {
+ char buf[PATH_MAX];
+ snprintf(buf, sizeof(buf), "non-regular classes ('%s') cannot inherit from regular classes ('%s')",
+ cl->full_name, icl->full_name);
+ return _obj_error(&cl->base, buf);
+ }
+ break;
+ default:
+ break;
+ }
if (!(res = _validate_class(src, icl, nhash)))
goto freehash;
}
}
static void
-_inherit_dep(Eo_Lexer *ls, Eina_Strbuf *buf, Eina_Bool check_inherit,
- Eolian_Class_Type type)
+_inherit_dep(Eo_Lexer *ls, Eina_Strbuf *buf)
{
const char *fname, *iname;
char *fnm;
eo_lexer_syntax_error(ls, ebuf);
return;
}
- if (check_inherit) switch (type)
- {
- case EOLIAN_CLASS_REGULAR:
- case EOLIAN_CLASS_ABSTRACT:
- if (dep->type != EOLIAN_CLASS_REGULAR && dep->type != EOLIAN_CLASS_ABSTRACT)
- {
- char ebuf[PATH_MAX];
- eo_lexer_context_restore(ls);
- snprintf(ebuf, sizeof(ebuf), "regular classes ('%s') cannot inherit from non-regular classes ('%s')",
- ls->tmp.kls->full_name, iname);
- eo_lexer_syntax_error(ls, ebuf);
- }
- break;
- case EOLIAN_CLASS_MIXIN:
- case EOLIAN_CLASS_INTERFACE:
- if (dep->type != EOLIAN_CLASS_MIXIN && dep->type != EOLIAN_CLASS_INTERFACE)
- {
- char ebuf[PATH_MAX];
- eo_lexer_context_restore(ls);
- snprintf(ebuf, sizeof(ebuf), "non-regular classes ('%s') cannot inherit from regular classes ('%s')",
- ls->tmp.kls->full_name, iname);
- eo_lexer_syntax_error(ls, ebuf);
- }
- break;
- default:
- break;
- }
ls->tmp.kls->inherits = eina_list_append(ls->tmp.kls->inherits, dep);
dep->toplevel = EINA_FALSE;
eo_lexer_context_pop(ls);
if (ls->t.token != ')')
{
Eina_Strbuf *ibuf = push_strbuf(ls);
- _inherit_dep(ls, ibuf, EINA_TRUE, type);
+ _inherit_dep(ls, ibuf);
while (test_next(ls, ','))
- _inherit_dep(ls, ibuf, EINA_FALSE, type);
+ _inherit_dep(ls, ibuf);
pop_strbuf(ls);
}
check_match(ls, ')', '(', line, col);