eolian: store typedecl/class in type
authorDaniel Kolesa <d.kolesa@osg.samsung.com>
Fri, 12 Jan 2018 16:25:23 +0000 (17:25 +0100)
committerWonki Kim <wonki_.kim@samsung.com>
Wed, 17 Jan 2018 09:19:29 +0000 (18:19 +0900)
src/lib/eolian/database_validate.c
src/lib/eolian/eolian_database.h

index 9ac74db..b6e40b6 100644 (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);
index f68093d..00a3967 100644 (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;