forked from enlightenment/efl
eolian: validate classes in a recursive manner
This allows for proper order of validation which will improve our performance when also validating for name duplicates.
This commit is contained in:
parent
903fd9065c
commit
05b395be47
|
@ -1,4 +1,5 @@
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
# include "config.h"
|
# include "config.h"
|
||||||
|
@ -369,10 +370,20 @@ _validate_class(Eolian_Class *cl)
|
||||||
Eolian_Function *func;
|
Eolian_Function *func;
|
||||||
Eolian_Event *event;
|
Eolian_Event *event;
|
||||||
Eolian_Implement *impl;
|
Eolian_Implement *impl;
|
||||||
|
const char *iname;
|
||||||
|
|
||||||
|
if (!cl)
|
||||||
|
return EINA_FALSE; /* if this happens something is very wrong though */
|
||||||
|
|
||||||
if (cl->base.validated)
|
if (cl->base.validated)
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
|
|
||||||
|
EINA_LIST_FOREACH(cl->inherits, l, iname)
|
||||||
|
{
|
||||||
|
if (!_validate_class(eina_hash_find(_classes, iname)))
|
||||||
|
return EINA_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
EINA_LIST_FOREACH(cl->properties, l, func)
|
EINA_LIST_FOREACH(cl->properties, l, func)
|
||||||
if (!_validate_function(func))
|
if (!_validate_function(func))
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
|
@ -435,7 +446,7 @@ database_validate()
|
||||||
/* FIXME: pass unit properly */
|
/* FIXME: pass unit properly */
|
||||||
Eina_Iterator *iter = eolian_all_classes_get(NULL);
|
Eina_Iterator *iter = eolian_all_classes_get(NULL);
|
||||||
EINA_ITERATOR_FOREACH(iter, cl)
|
EINA_ITERATOR_FOREACH(iter, cl)
|
||||||
if (!_validate_class(cl))
|
if (cl->toplevel && !_validate_class(cl))
|
||||||
{
|
{
|
||||||
eina_iterator_free(iter);
|
eina_iterator_free(iter);
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
|
|
|
@ -1985,7 +1985,7 @@ _inherit_dep(Eo_Lexer *ls, Eina_Strbuf *buf, Eina_Bool check_inherit,
|
||||||
}
|
}
|
||||||
_parse_dep(ls, fname, iname);
|
_parse_dep(ls, fname, iname);
|
||||||
/* FIXME: pass unit properly */
|
/* FIXME: pass unit properly */
|
||||||
const Eolian_Class *dep = eolian_class_get_by_name(NULL, iname);
|
Eolian_Class *dep = (Eolian_Class *)eolian_class_get_by_name(NULL, iname);
|
||||||
if (!dep)
|
if (!dep)
|
||||||
{
|
{
|
||||||
char ebuf[PATH_MAX];
|
char ebuf[PATH_MAX];
|
||||||
|
@ -2023,6 +2023,7 @@ _inherit_dep(Eo_Lexer *ls, Eina_Strbuf *buf, Eina_Bool check_inherit,
|
||||||
}
|
}
|
||||||
ls->tmp.kls->inherits = eina_list_append(ls->tmp.kls->inherits,
|
ls->tmp.kls->inherits = eina_list_append(ls->tmp.kls->inherits,
|
||||||
eina_stringshare_add(iname));
|
eina_stringshare_add(iname));
|
||||||
|
dep->toplevel = EINA_FALSE;
|
||||||
eo_lexer_context_pop(ls);
|
eo_lexer_context_pop(ls);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2036,6 +2037,7 @@ parse_class(Eo_Lexer *ls, Eolian_Class_Type type)
|
||||||
int line, col;
|
int line, col;
|
||||||
Eina_Strbuf *buf = push_strbuf(ls);
|
Eina_Strbuf *buf = push_strbuf(ls);
|
||||||
ls->tmp.kls = calloc(1, sizeof(Eolian_Class));
|
ls->tmp.kls = calloc(1, sizeof(Eolian_Class));
|
||||||
|
ls->tmp.kls->toplevel = EINA_TRUE;
|
||||||
FILL_BASE(ls->tmp.kls->base, ls, ls->line_number, ls->column);
|
FILL_BASE(ls->tmp.kls->base, ls, ls->line_number, ls->column);
|
||||||
eo_lexer_get(ls);
|
eo_lexer_get(ls);
|
||||||
ls->tmp.kls->type = type;
|
ls->tmp.kls->type = type;
|
||||||
|
|
|
@ -99,6 +99,7 @@ struct _Eolian_Class
|
||||||
Eina_List *events; /* List event_name -> Eolian_Event */
|
Eina_List *events; /* List event_name -> Eolian_Event */
|
||||||
Eina_Bool class_ctor_enable:1;
|
Eina_Bool class_ctor_enable:1;
|
||||||
Eina_Bool class_dtor_enable:1;
|
Eina_Bool class_dtor_enable:1;
|
||||||
|
Eina_Bool toplevel:1;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _Eolian_Function
|
struct _Eolian_Function
|
||||||
|
|
Loading…
Reference in New Issue