eolian: remove constructors section cruft
authorDaniel Kolesa <d.kolesa@samsung.com>
Wed, 27 Aug 2014 14:38:28 +0000 (15:38 +0100)
committerDaniel Kolesa <d.kolesa@samsung.com>
Wed, 27 Aug 2014 14:43:47 +0000 (15:43 +0100)
14 files changed:
src/bin/eolian_cxx/convert.cc
src/bin/eolian_cxx/eolian_wrappers.hh
src/lib/eolian/Eolian.h
src/lib/eolian/database_class.c
src/lib/eolian/database_class_api.c
src/lib/eolian/database_fill.c
src/lib/eolian/database_function_api.c
src/lib/eolian/database_print.c
src/lib/eolian/database_validate.c
src/lib/eolian/eo_definitions.c
src/lib/eolian/eo_definitions.h
src/lib/eolian/eo_lexer.h
src/lib/eolian/eo_parser.c
src/lib/eolian/eolian_database.h

index 3f20f73a18d33456907431093232dde9b2075d8b..56f2c06869ff046cf16fb40a78da70a2180a73ce 100644 (file)
@@ -212,7 +212,8 @@ convert_eolian_implements(efl::eolian::eo_class& cls, Eolian_Class const& klass)
         const Eolian_Class *impl_class = eolian_implement_class_get(impl_desc);
         Eolian_Function_Type impl_type;
         const Eolian_Function *impl_func = eolian_implement_function_get(impl_desc, &impl_type);
-        if (impl_type == EOLIAN_CTOR)
+        /* fixme */
+        if (eolian_function_is_constructing(impl_func))
           {
              efl::eolian::eo_constructor constructor;
              std::string parent = safe_lower(eolian_class_full_name_get(impl_class));
@@ -236,6 +237,7 @@ convert_eolian_constructors(efl::eolian::eo_class& cls, Eolian_Class const& klas
    EINA_ITERATOR_FOREACH(constructors, curr)
      {
         Eolian_Function *eo_constructor = static_cast<Eolian_Function*>(curr);
+        /* fixme */
         if (!eolian_function_is_constructing(eo_constructor))
           continue;
         efl::eolian::eo_constructor constructor;
@@ -258,6 +260,7 @@ convert_eolian_functions(efl::eolian::eo_class& cls, Eolian_Class const& klass)
      {
         efl::eolian::eo_function func_;
         Eolian_Function *eol_func = static_cast<Eolian_Function*>(curr);
+        /* fixme */
         if (eolian_function_is_constructing(eol_func))
           continue;
         // XXX Eolian only provides regular methods so far
index 5912c3ef00c71f9dd0318831c9e060f81c7685c0..fc8e808adca32c12b67b966affb5a577217bdb91 100644 (file)
@@ -25,7 +25,8 @@ getter_t const getter = {};
 struct method_t { static constexpr ::Eolian_Function_Type value = ::EOLIAN_METHOD; };
 method_t const method = {};
 
-struct ctor_t { static constexpr ::Eolian_Function_Type value = ::EOLIAN_CTOR; };
+/* fixme */
+struct ctor_t { static constexpr ::Eolian_Function_Type value = ::EOLIAN_METHOD; };
 ctor_t const ctor = {};
 
 inline const Eolian_Class*
index 84fb1d1491f7fa238e026bc6f00e5e8868ed4575..43fdc6bbcfa4ce324625dad5543793e8d1bcb73e 100644 (file)
@@ -104,8 +104,7 @@ typedef enum
    EOLIAN_PROPERTY,
    EOLIAN_PROP_SET,
    EOLIAN_PROP_GET,
-   EOLIAN_METHOD,
-   EOLIAN_CTOR
+   EOLIAN_METHOD
 } Eolian_Function_Type;
 
 typedef enum
index a8e31edff902b778445790ca02e758e460ef586a..79999a999f3836881b61fb42736e1b60edb6a5c4 100644 (file)
@@ -23,7 +23,6 @@ database_class_del(Eolian_Class *cl)
         free(impl);
      }
 
-   EINA_LIST_FREE(cl->constructors, fid) database_function_del(fid);
    EINA_LIST_FREE(cl->methods, fid) database_function_del(fid);
    EINA_LIST_FREE(cl->properties, fid) database_function_del(fid);
    EINA_LIST_FREE(cl->events, ev) database_event_del(ev);
index 2b785184a321c04986cf9ad20d67760ae3a0242b..d624c2723104c1b187a54fba48f211a45b7f98c4 100644 (file)
@@ -125,15 +125,6 @@ eolian_class_function_get_by_name(const Eolian_Class *cl, const char *func_name,
           }
      }
 
-   if (f_type == EOLIAN_UNRESOLVED || f_type == EOLIAN_CTOR)
-     {
-        EINA_LIST_FOREACH(cl->constructors, itr, fid)
-          {
-             if (!strcmp(fid->name, func_name))
-                return fid;
-          }
-     }
-
    ERR("Function %s not found in class %s", func_name, cl->name);
    return NULL;
 }
@@ -148,8 +139,6 @@ eolian_class_functions_get(const Eolian_Class *cl, Eolian_Function_Type foo_type
          return (cl->properties ? eina_list_iterator_new(cl->properties) : NULL);
       case EOLIAN_METHOD:
          return (cl->methods ? eina_list_iterator_new(cl->methods) : NULL);
-      case EOLIAN_CTOR:
-         return (cl->constructors ? eina_list_iterator_new(cl->constructors) : NULL);
       default: return NULL;
      }
 }
index fce6f94bae184d6983041a3a5c7960859ebcc049..6210fc23f787f1307e09bc00f320adcd140fe20c 100644 (file)
@@ -225,38 +225,6 @@ _db_fill_methods(Eolian_Class *cl, Eo_Class_Def *kls)
    return EINA_TRUE;
 }
 
-static Eina_Bool
-_db_fill_ctor(Eolian_Class *cl, Eo_Method_Def *meth)
-{
-   Eolian_Function *foo_id = database_function_new(meth->name, EOLIAN_CTOR);
-
-   cl->constructors = eina_list_append(cl->constructors, foo_id);
-
-   if (meth->ret)
-     foo_id->get_return_comment = eina_stringshare_ref(meth->ret->comment);
-
-   foo_id->get_legacy = eina_stringshare_ref(meth->legacy);
-
-   _db_fill_params(meth->params, &(foo_id->params));
-
-   foo_id->base = meth->base;
-   meth->base.file = NULL;
-
-   return EINA_TRUE;
-}
-
-static Eina_Bool
-_db_fill_ctors(Eolian_Class *cl, Eo_Class_Def *kls)
-{
-   Eo_Method_Def *meth;
-   Eina_List *l;
-
-   EINA_LIST_FOREACH(kls->constructors, l, meth)
-     if (!_db_fill_ctor(cl, meth)) return EINA_FALSE;
-
-   return EINA_TRUE;
-}
-
 static int
 _db_fill_implement(Eolian_Class *cl, Eolian_Implement *impl)
 {
@@ -371,7 +339,6 @@ _db_fill_class(Eo_Class_Def *kls)
    if (kls->data_type)
      cl->data_type = eina_stringshare_ref(kls->data_type);
 
-   if (!_db_fill_ctors     (cl, kls)) return EINA_FALSE;
    if (!_db_fill_properties(cl, kls)) return EINA_FALSE;
    if (!_db_fill_methods   (cl, kls)) return EINA_FALSE;
    if (!_db_fill_implements(cl, kls)) return EINA_FALSE;
index c5156a098035027d43e48eb17a04614d9a11eaee..ecd18533937decfa8fcb4aa8225d6f00ee98e36c 100644 (file)
@@ -62,7 +62,7 @@ eolian_function_legacy_get(const Eolian_Function *fid, Eolian_Function_Type ftyp
    EINA_SAFETY_ON_NULL_RETURN_VAL(fid, NULL);
    switch (ftype)
      {
-      case EOLIAN_UNRESOLVED: case EOLIAN_METHOD: case EOLIAN_PROPERTY: case EOLIAN_CTOR: case EOLIAN_PROP_GET: return fid->get_legacy; break;
+      case EOLIAN_UNRESOLVED: case EOLIAN_METHOD: case EOLIAN_PROPERTY: case EOLIAN_PROP_GET: return fid->get_legacy; break;
       case EOLIAN_PROP_SET: return fid->set_legacy; break;
       default: return NULL;
      }
@@ -74,7 +74,7 @@ eolian_function_description_get(const Eolian_Function *fid, Eolian_Function_Type
    EINA_SAFETY_ON_NULL_RETURN_VAL(fid, NULL);
    switch (ftype)
      {
-      case EOLIAN_UNRESOLVED: case EOLIAN_METHOD: case EOLIAN_PROPERTY: case EOLIAN_CTOR: case EOLIAN_PROP_GET: return fid->get_description; break;
+      case EOLIAN_UNRESOLVED: case EOLIAN_METHOD: case EOLIAN_PROPERTY: case EOLIAN_PROP_GET: return fid->get_description; break;
       case EOLIAN_PROP_SET: return fid->set_description; break;
       default: return NULL;
      }
@@ -86,7 +86,7 @@ eolian_function_is_virtual_pure(const Eolian_Function *fid, Eolian_Function_Type
    EINA_SAFETY_ON_NULL_RETURN_VAL(fid, EINA_FALSE);
    switch (ftype)
      {
-      case EOLIAN_UNRESOLVED: case EOLIAN_METHOD: case EOLIAN_PROPERTY: case EOLIAN_CTOR: case EOLIAN_PROP_GET: return fid->get_virtual_pure; break;
+      case EOLIAN_UNRESOLVED: case EOLIAN_METHOD: case EOLIAN_PROPERTY: case EOLIAN_PROP_GET: return fid->get_virtual_pure; break;
       case EOLIAN_PROP_SET: return fid->set_virtual_pure; break;
       default: return EINA_FALSE;
      }
@@ -98,7 +98,7 @@ eolian_function_is_legacy_only(const Eolian_Function *fid, Eolian_Function_Type
    EINA_SAFETY_ON_NULL_RETURN_VAL(fid, EINA_FALSE);
    switch (ftype)
      {
-      case EOLIAN_UNRESOLVED: case EOLIAN_METHOD: case EOLIAN_PROPERTY: case EOLIAN_CTOR: case EOLIAN_PROP_GET: return fid->get_only_legacy; break;
+      case EOLIAN_UNRESOLVED: case EOLIAN_METHOD: case EOLIAN_PROPERTY: case EOLIAN_PROP_GET: return fid->get_only_legacy; break;
       case EOLIAN_PROP_SET: return fid->set_only_legacy; break;
       default: return EINA_FALSE;
      }
@@ -157,7 +157,7 @@ eolian_function_return_type_get(const Eolian_Function *fid, Eolian_Function_Type
    switch (ftype)
      {
       case EOLIAN_PROP_SET: return fid->set_ret_type;
-      case EOLIAN_UNRESOLVED: case EOLIAN_METHOD: case EOLIAN_CTOR: case EOLIAN_PROP_GET: return fid->get_ret_type;
+      case EOLIAN_UNRESOLVED: case EOLIAN_METHOD: case EOLIAN_PROP_GET: return fid->get_ret_type;
       default: return NULL;
      }
 }
@@ -168,7 +168,7 @@ eolian_function_return_default_value_get(const Eolian_Function *fid, Eolian_Func
    switch (ftype)
      {
       case EOLIAN_PROP_SET: return fid->set_ret_val;
-      case EOLIAN_UNRESOLVED: case EOLIAN_METHOD: case EOLIAN_CTOR: case EOLIAN_PROPERTY: case EOLIAN_PROP_GET: return fid->get_ret_val;
+      case EOLIAN_UNRESOLVED: case EOLIAN_METHOD: case EOLIAN_PROPERTY: case EOLIAN_PROP_GET: return fid->get_ret_val;
       default: return NULL;
      }
 }
@@ -179,7 +179,7 @@ eolian_function_return_comment_get(const Eolian_Function *fid, Eolian_Function_T
    switch (ftype)
      {
       case EOLIAN_PROP_SET: return fid->set_return_comment; break;
-      case EOLIAN_UNRESOLVED: case EOLIAN_METHOD: case EOLIAN_CTOR: case EOLIAN_PROPERTY: case EOLIAN_PROP_GET: return fid->get_return_comment; break;
+      case EOLIAN_UNRESOLVED: case EOLIAN_METHOD: case EOLIAN_PROPERTY: case EOLIAN_PROP_GET: return fid->get_return_comment; break;
       default: return NULL;
      }
 }
@@ -191,7 +191,7 @@ eolian_function_return_is_warn_unused(const Eolian_Function *fid,
    EINA_SAFETY_ON_NULL_RETURN_VAL(fid, EINA_FALSE);
    switch (ftype)
      {
-      case EOLIAN_METHOD: case EOLIAN_PROP_GET: case EOLIAN_CTOR: case EOLIAN_PROPERTY: return fid->get_return_warn_unused;
+      case EOLIAN_METHOD: case EOLIAN_PROP_GET: case EOLIAN_PROPERTY: return fid->get_return_warn_unused;
       case EOLIAN_PROP_SET: return fid->set_return_warn_unused;
       default: return EINA_FALSE;
      }
index a1fd411c0274c17cffdd87ee897eb680d33e82cf..ef48abefa243ffcc0c33ba3241b8623cdda9b01f 100644 (file)
@@ -117,22 +117,6 @@ static Eina_Bool _function_print(const Eolian_Function *fid, int nb_spaces)
               if (fid->obj_is_const) printf("%*sobj const: <true>\n", nb_spaces + 5, "");
               break;
            }
-      case EOLIAN_CTOR:
-           {
-              //char *str = eina_hash_find(fid->data, "comment");
-              const char *str = eolian_function_description_get(fid, EOLIAN_METHOD);
-              if (str) printf("%*s<%s>\n", nb_spaces + 5, "", str);
-              str = eolian_function_legacy_get(fid, EOLIAN_METHOD);
-              if (str) printf("%*slegacy: <%s>\n", nb_spaces + 5, "", str);
-              tp = eolian_function_return_type_get(fid, EOLIAN_METHOD);
-              if (tp)
-                {
-                   printf("%*sreturn type: <", nb_spaces + 5, "");
-                   database_type_print((Eolian_Type*)tp);
-                   printf(">\n");
-                }
-              break;
-           }
       default:
          return EINA_FALSE;
      }
@@ -202,14 +186,6 @@ _class_print(const Eolian_Class *cl)
         printf("  Data type: <%s>\n", cl->data_type);
      }
 
-   // Constructors
-   printf("  constructors:\n");
-   EINA_LIST_FOREACH(cl->constructors, itr, function)
-     {
-        _function_print(function, 4);
-     }
-   printf("\n");
-
    // Properties
    printf("  properties:\n");
    EINA_LIST_FOREACH(cl->properties, itr, function)
index 02f9caa8b18ed5e52937275eec645fc2a9bf92f8..25251cbd71cd845bdd59d23c27073e29b25b75de 100644 (file)
@@ -201,10 +201,6 @@ _validate_class(const Eolian_Class *cl)
      if (!_validate_function(func))
        return EINA_FALSE;
 
-   EINA_LIST_FOREACH(cl->constructors, l, func)
-     if (!_validate_function(func))
-       return EINA_FALSE;
-
    EINA_LIST_FOREACH(cl->events, l, event)
      if (!_validate_event(event))
        return EINA_FALSE;
index fd03c242d1cccfae4633203b8c5b30ba77e251d6..34cd5bfbc5f1cd53dc450ac7a2c0cd3981b8ce02 100644 (file)
@@ -128,9 +128,6 @@ eo_definitions_class_def_free(Eo_Class_Def *kls)
    EINA_LIST_FREE(kls->implements, impl)
      database_implement_del(impl);
 
-   EINA_LIST_FREE(kls->constructors, meth)
-     eo_definitions_method_def_free(meth);
-
    EINA_LIST_FREE(kls->properties, prop)
      eo_definitions_property_def_free(prop);
 
index 68ee8331664d06661b67db8fb1e88b828407a8fc..ad5048475a42b1c24f59d2c79a92f9b137745706 100644 (file)
@@ -99,7 +99,6 @@ typedef struct _Eo_Class_Def
    Eina_List *inherits;
    Eina_List *implements;
    Eina_List *events;
-   Eina_List *constructors;
    Eina_List *properties;
    Eina_List *methods;
 } Eo_Class_Def;
index 9d608ef8735b9d27d00adbb5a551fd7c69d43be2..55301780e2a2aa43b722dc7a8da7981b6fade7e6 100644 (file)
@@ -24,14 +24,13 @@ enum Tokens
 #define KEYWORDS KW(class), KW(const), KW(enum), KW(return), KW(struct), \
     KW(virtual), \
     \
-    KW(abstract), KW(constructor), KW(constructors), KW(data), \
-    KW(destructor), KW(eo), KW(eo_prefix), KW(events), KW(free), KW(func), \
-    KW(get), KW(implements), KW(interface), KW(keys), KW(legacy), \
-    KW(legacy_prefix), KW(methods), KW(mixin), KW(own), KW(params), \
-    KW(properties), KW(set), KW(type), KW(values), KW(var), KWAT(class), \
-    KWAT(const), KWAT(constructor), KWAT(extern), KWAT(free), KWAT(in), \
-    KWAT(inout), KWAT(nonull), KWAT(out), KWAT(private), KWAT(protected), \
-    KWAT(warn_unused), \
+    KW(abstract), KW(constructor), KW(data), KW(destructor), KW(eo), \
+    KW(eo_prefix), KW(events), KW(free), KW(func), KW(get), KW(implements), \
+    KW(interface), KW(keys), KW(legacy), KW(legacy_prefix), KW(methods), \
+    KW(mixin), KW(own), KW(params), KW(properties), KW(set), KW(type), \
+    KW(values), KW(var), KWAT(class), KWAT(const), KWAT(constructor), \
+    KWAT(extern), KWAT(free), KWAT(in), KWAT(inout), KWAT(nonull), KWAT(out), \
+    KWAT(private), KWAT(protected), KWAT(warn_unused), \
     \
     KW(byte), KW(ubyte), KW(char), KW(short), KW(ushort), KW(int), KW(uint), \
     KW(long), KW(ulong), KW(llong), KW(ullong), \
index 1894129b7fc4723c82b5669895860db7e26563f5..76f0cf54970ee5475b29320e7095c92b40b72e42 100644 (file)
@@ -1619,19 +1619,6 @@ parse_event(Eo_Lexer *ls)
      }
 }
 
-static void
-parse_constructors(Eo_Lexer *ls)
-{
-   PARSE_SECTION
-     {
-        parse_method(ls, EINA_TRUE);
-        ls->tmp.kls->constructors = eina_list_append(ls->tmp.kls->constructors,
-                                                     ls->tmp.meth);
-        ls->tmp.meth = NULL;
-     }
-   check_match(ls, '}', '{', line, col);
-}
-
 static void
 parse_methods(Eo_Lexer *ls)
 {
@@ -1691,12 +1678,11 @@ parse_events(Eo_Lexer *ls)
 }
 
 static void
-parse_class_body(Eo_Lexer *ls, Eina_Bool allow_ctors, Eolian_Class_Type type)
+parse_class_body(Eo_Lexer *ls, Eolian_Class_Type type)
 {
    Eina_Bool has_legacy_prefix = EINA_FALSE,
              has_eo_prefix     = EINA_FALSE,
              has_data          = EINA_FALSE,
-             has_constructors  = EINA_FALSE,
              has_properties    = EINA_FALSE,
              has_methods       = EINA_FALSE,
              has_implements    = EINA_FALSE,
@@ -1740,12 +1726,6 @@ parse_class_body(Eo_Lexer *ls, Eina_Bool allow_ctors, Eolian_Class_Type type)
         eo_lexer_get(ls);
         check_next(ls, ';');
         break;
-      case KW_constructors:
-        if (!allow_ctors)
-          return;
-        CASE_LOCK(ls, constructors, "constructors definition")
-        parse_constructors(ls);
-        break;
       case KW_properties:
         CASE_LOCK(ls, properties, "properties definition")
         parse_properties(ls);
@@ -1768,7 +1748,7 @@ parse_class_body(Eo_Lexer *ls, Eina_Bool allow_ctors, Eolian_Class_Type type)
 }
 
 static void
-parse_class(Eo_Lexer *ls, Eina_Bool allow_ctors, Eolian_Class_Type type)
+parse_class(Eo_Lexer *ls, Eolian_Class_Type type)
 {
    const char *bnm;
    char *fnm;
@@ -1811,7 +1791,7 @@ parse_class(Eo_Lexer *ls, Eina_Bool allow_ctors, Eolian_Class_Type type)
    line = ls->line_number;
    col = ls->column;
    check_next(ls, '{');
-   parse_class_body(ls, allow_ctors, type);
+   parse_class_body(ls, type);
    check_match(ls, '}', '{', line, col);
 }
 
@@ -1822,19 +1802,19 @@ parse_unit(Eo_Lexer *ls, Eina_Bool eot)
      {
       case KW_abstract:
         if (eot) goto def;
-        parse_class(ls, EINA_TRUE, EOLIAN_CLASS_ABSTRACT);
+        parse_class(ls, EOLIAN_CLASS_ABSTRACT);
         goto found_class;
       case KW_class:
         if (eot) goto def;
-        parse_class(ls, EINA_TRUE, EOLIAN_CLASS_REGULAR);
+        parse_class(ls, EOLIAN_CLASS_REGULAR);
         goto found_class;
       case KW_mixin:
         if (eot) goto def;
-        parse_class(ls, EINA_FALSE, EOLIAN_CLASS_MIXIN);
+        parse_class(ls, EOLIAN_CLASS_MIXIN);
         goto found_class;
       case KW_interface:
         if (eot) goto def;
-        parse_class(ls, EINA_FALSE, EOLIAN_CLASS_INTERFACE);
+        parse_class(ls, EOLIAN_CLASS_INTERFACE);
         goto found_class;
       case KW_type:
         {
index 29cb69eee923b309e5af582f5178d904190c65f6..ae305217eddfea4f29dbadda9a1a260413817a89 100644 (file)
@@ -77,7 +77,6 @@ struct _Eolian_Class
    Eina_List *inherits; /* List Eina_Stringshare * */
    Eina_List *properties; /* List prop_name -> Eolian_Function */
    Eina_List *methods; /* List meth_name -> Eolian_Function */
-   Eina_List *constructors; /* List constructor_name -> Eolian_Function */
    Eina_List *implements; /* List implements name -> Eolian_Implement */
    Eina_List *events; /* List event_name -> Eolian_Event */
    Eina_Bool class_ctor_enable:1;