eolian: remove constructors section cruft

This commit is contained in:
Daniel Kolesa 2014-08-27 15:38:28 +01:00
parent 1a76690abf
commit b69b90832f
14 changed files with 29 additions and 125 deletions

View 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

View 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*

View 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

View 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);

View 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;
}
}

View 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;

View 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;
}

View 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)

View 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;

View 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);

View 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;

View 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), \

View 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:
{

View 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;