eolian: store typedecl/class in type

This commit is contained in:
Daniel Kolesa 2018-01-12 17:25:23 +01:00
parent 4dfde2cd24
commit db41734954
2 changed files with 12 additions and 7 deletions

View File

@ -225,7 +225,6 @@ _validate_type(const Eolian_Unit *src, Eolian_Type *tp)
}
return _validate(&tp->base);
}
Eolian_Typedecl *tpp;
/* builtins */
int id = eo_lexer_keyword_str_to_id(tp->full_name);
if (id)
@ -253,21 +252,22 @@ _validate_type(const Eolian_Unit *src, Eolian_Type *tp)
return _validate(&tp->base);
}
/* user defined */
tpp = (Eolian_Typedecl *)eolian_type_typedecl_get(src, tp);
if (!tpp)
tp->tdecl = (Eolian_Typedecl *)eolian_type_typedecl_get(src, tp);
if (!tp->tdecl)
{
snprintf(buf, sizeof(buf), "undefined type %s", tp->full_name);
return _obj_error(&tp->base, buf);
}
if (!_validate_typedecl(src, tpp))
if (!_validate_typedecl(src, tp->tdecl))
return EINA_FALSE;
if (tpp->freefunc && !tp->freefunc)
tp->freefunc = eina_stringshare_ref(tpp->freefunc);
if (tp->tdecl->freefunc && !tp->freefunc)
tp->freefunc = eina_stringshare_ref(tp->tdecl->freefunc);
return _validate(&tp->base);
}
case EOLIAN_TYPE_CLASS:
{
if (!eolian_type_class_get(src, tp))
tp->klass = (Eolian_Class *)eolian_type_class_get(src, tp);
if (!tp->klass)
{
snprintf(buf, sizeof(buf), "undefined class %s "
"(likely wrong namespacing)", tp->full_name);

View File

@ -196,6 +196,11 @@ struct _Eolian_Type
Eina_Stringshare *full_name;
Eina_List *namespaces;
Eina_Stringshare *freefunc;
union
{
Eolian_Class *klass;
Eolian_Typedecl *tdecl;
};
Eina_Bool is_const :1;
Eina_Bool is_ptr :1;
Eina_Bool owned :1;