aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/eolian/database_validate.c
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@osg.samsung.com>2017-12-22 12:41:29 +0100
committerDaniel Kolesa <d.kolesa@osg.samsung.com>2017-12-22 15:36:31 +0100
commite1bcd61bdf964b9e38923bdb590b8f00bfc31876 (patch)
tree611cad5920c3d2c119be8d08471fbcb3193ab2b8 /src/lib/eolian/database_validate.c
parentdocs: Update evas canvas eo files for grammar and readability (diff)
downloadefl-e1bcd61bdf964b9e38923bdb590b8f00bfc31876.tar.gz
eolian: move inherit type checking to validation
Diffstat (limited to 'src/lib/eolian/database_validate.c')
-rw-r--r--src/lib/eolian/database_validate.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/lib/eolian/database_validate.c b/src/lib/eolian/database_validate.c
index 6706464172..cf5f741f0b 100644
--- a/src/lib/eolian/database_validate.c
+++ b/src/lib/eolian/database_validate.c
@@ -445,6 +445,32 @@ _validate_class(const Eolian_Unit *src, Eolian_Class *cl, Eina_Hash *nhash)
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;
}