eolian: more relaxed rules on what is actually ownable
authorDaniel Kolesa <d.kolesa@osg.samsung.com>
Wed, 13 Sep 2017 22:34:06 +0000 (00:34 +0200)
committerDaniel Kolesa <d.kolesa@osg.samsung.com>
Wed, 13 Sep 2017 22:34:06 +0000 (00:34 +0200)
For example, aliases to ownable types are now also ownable,
which wasn't possible in the previous version, where you could
only own actual expanded ownable types.

src/lib/eolian/database_type.c

index df7cbae..a05fa25 100644 (file)
@@ -92,7 +92,16 @@ database_type_is_ownable(const Eolian_Type *tp, Eina_Bool term)
           return EINA_TRUE;
         const char *ct = eo_lexer_get_c_type(kwid);
         if (!ct)
-          return EINA_FALSE;
+          {
+             const Eolian_Typedecl *tpp = eolian_type_typedecl_get(tp);
+             if (!tpp)
+               return EINA_FALSE;
+             if (tpp->type == EOLIAN_TYPEDECL_FUNCTION_POINTER)
+               return EINA_TRUE;
+             if (tpp->type == EOLIAN_TYPEDECL_ALIAS)
+               return database_type_is_ownable(tpp->base_type, term);
+             return EINA_FALSE;
+          }
         return (ct[strlen(ct) - 1] == '*');
      }
    return _ownable_types[tp->type];