eolian: better error information + fix tests

This provides better location info when failing to resolve EOLIAN_TYPE_CLASS.
Also fixes tests I forgot to push before.
This commit is contained in:
Daniel Kolesa 2014-07-30 15:51:08 +01:00
parent c88c0d9347
commit 6aa99c0026
5 changed files with 49 additions and 37 deletions

View File

@ -445,6 +445,7 @@ parse_type_struct_void(Eo_Lexer *ls, Eina_Bool allow_struct)
const char *bnm, *nm;
char *fnm;
buf = push_strbuf(ls);
eo_lexer_context_push(ls);
parse_name(ls, buf);
nm = eina_strbuf_string_get(buf);
bnm = get_filename(ls);
@ -456,8 +457,13 @@ parse_type_struct_void(Eo_Lexer *ls, Eina_Bool allow_struct)
free(fnm);
if (fname)
{
if (!eolian_class_get_by_name(nm) && !eolian_eo_file_parse(fname))
eo_lexer_syntax_error(ls, "failed to parse dependency");
if (!eolian_class_get_by_name(nm)
&& !eolian_eo_file_parse(fname))
{
eo_lexer_context_restore(ls);
eo_lexer_syntax_error(ls,
"failed to parse dependency");
}
def->type = EOLIAN_TYPE_CLASS;
}
}
@ -467,6 +473,7 @@ parse_type_struct_void(Eo_Lexer *ls, Eina_Bool allow_struct)
free(fnm);
def->type = EOLIAN_TYPE_CLASS;
}
eo_lexer_context_pop(ls);
_fill_type_name(def, eina_stringshare_add(nm));
pop_strbuf(ls);
}
@ -1178,6 +1185,7 @@ parse_class(Eo_Lexer *ls, Eina_Bool allow_ctors, Eolian_Class_Type type)
ls->tmp.kls = calloc(1, sizeof(Eo_Class_Def));
eo_lexer_get(ls);
ls->tmp.kls->type = type;
eo_lexer_context_push(ls);
parse_name(ls, buf);
bnm = get_filename(ls);
fnm = database_class_to_filename(eina_strbuf_string_get(buf));
@ -1185,7 +1193,11 @@ parse_class(Eo_Lexer *ls, Eina_Bool allow_ctors, Eolian_Class_Type type)
eina_stringshare_del(bnm);
free(fnm);
if (!same)
eo_lexer_syntax_error(ls, "class and file names differ");
{
eo_lexer_context_restore(ls);
eo_lexer_syntax_error(ls, "class and file names differ");
}
eo_lexer_context_pop(ls);
ls->tmp.kls->name = eina_stringshare_add(eina_strbuf_string_get(buf));
pop_strbuf(ls);
ls->tmp.kls->file = get_filename(ls);

View File

@ -1,88 +1,88 @@
#define EFL_BETA_API_SUPPORT
#include <Eo.h>
#include "object.eo.h"
#include "object_impl.eo.h"
typedef struct
{
} Object_Data;
} Object_Impl_Data;
EOLIAN static Eina_Bool
_object_a_set(Eo *obj, Object_Data *pd, const char *part, const Eina_List *value)
_object_impl_a_set(Eo *obj, Object_Impl_Data *pd, const char *part, const Eina_List *value)
{
}
EOLIAN static Eina_List *
_object_a_get(Eo *obj, Object_Data *pd, const char *part)
_object_impl_a_get(Eo *obj, Object_Impl_Data *pd, const char *part)
{
}
EOLIAN static void
_object_b_set(Eo *obj, Object_Data *pd, Eina_List *value)
_object_impl_b_set(Eo *obj, Object_Impl_Data *pd, Eina_List *value)
{
}
EOLIAN static char *
_object_foo1(Eo *obj, Object_Data *pd, int a, char *b, double *c)
_object_impl_foo1(Eo *obj, Object_Impl_Data *pd, int a, char *b, double *c)
{
}
EOLIAN static void
_object_foo2(const Eo *obj, Object_Data *pd, int a, const char *b)
_object_impl_foo2(const Eo *obj, Object_Impl_Data *pd, int a, const char *b)
{
}
EOLIAN static void
_object_constructor_1(Eo *obj, Object_Data *pd, int a, char b)
_object_impl_constructor_1(Eo *obj, Object_Impl_Data *pd, int a, char b)
{
}
EOLIAN static void
_object_constructor_2(Eo *obj, Object_Data *pd)
_object_impl_constructor_2(Eo *obj, Object_Impl_Data *pd)
{
}
EOLIAN static void
_object_base_constructor(Eo *obj, Object_Data *pd)
_object_impl_base_constructor(Eo *obj, Object_Impl_Data *pd)
{
eo_do_super(obj, OBJECT_CLASS, base_constructor());
}
EOLIAN static void
_object_base_destructor(Eo *obj, Object_Data *pd)
_object_impl_base_destructor(Eo *obj, Object_Impl_Data *pd)
{
eo_do_super(obj, OBJECT_CLASS, base_destructor());
}
EOLIAN static void
_object_class_constructor(Eo_Class *klass)
_object_impl_class_constructor(Eo_Class *klass)
{
}
EOLIAN static void
_object_class_destructor(Eo_Class *klass)
_object_impl_class_destructor(Eo_Class *klass)
{
}
EOLIAN static void
_object_c_set(Eo *obj, Object_Data *pd, Eina_List *value)
_object_impl_add_c_set(Eo *obj, Object_Impl_Data *pd, Eina_List *value)
{
}
EOLIAN static Eina_List *
_object_c_get(Eo *obj, Object_Data *pd)
_object_impl_add_c_get(Eo *obj, Object_Impl_Data *pd)
{
}

View File

@ -1,76 +1,76 @@
#define EFL_BETA_API_SUPPORT
#include <Eo.h>
#include "object.eo.h"
#include "object_impl.eo.h"
typedef struct
{
} Object_Data;
} Object_Impl_Data;
EOLIAN static Eina_Bool
_object_a_set(Eo *obj, Object_Data *pd, const char *part, const Eina_List *value)
_object_impl_a_set(Eo *obj, Object_Impl_Data *pd, const char *part, const Eina_List *value)
{
}
EOLIAN static Eina_List *
_object_a_get(Eo *obj, Object_Data *pd, const char *part)
_object_impl_a_get(Eo *obj, Object_Impl_Data *pd, const char *part)
{
}
EOLIAN static void
_object_b_set(Eo *obj, Object_Data *pd, Eina_List *value)
_object_impl_b_set(Eo *obj, Object_Impl_Data *pd, Eina_List *value)
{
}
EOLIAN static char *
_object_foo1(Eo *obj, Object_Data *pd, int a, char *b, double *c)
_object_impl_foo1(Eo *obj, Object_Impl_Data *pd, int a, char *b, double *c)
{
}
EOLIAN static void
_object_foo2(const Eo *obj, Object_Data *pd, int a, const char *b)
_object_impl_foo2(const Eo *obj, Object_Impl_Data *pd, int a, const char *b)
{
}
EOLIAN static void
_object_constructor_1(Eo *obj, Object_Data *pd, int a, char b)
_object_impl_constructor_1(Eo *obj, Object_Impl_Data *pd, int a, char b)
{
}
EOLIAN static void
_object_constructor_2(Eo *obj, Object_Data *pd)
_object_impl_constructor_2(Eo *obj, Object_Impl_Data *pd)
{
}
EOLIAN static void
_object_base_constructor(Eo *obj, Object_Data *pd)
_object_impl_base_constructor(Eo *obj, Object_Impl_Data *pd)
{
eo_do_super(obj, OBJECT_CLASS, base_constructor());
}
EOLIAN static void
_object_base_destructor(Eo *obj, Object_Data *pd)
_object_impl_base_destructor(Eo *obj, Object_Impl_Data *pd)
{
eo_do_super(obj, OBJECT_CLASS, base_destructor());
}
EOLIAN static void
_object_class_constructor(Eo_Class *klass)
_object_impl_class_constructor(Eo_Class *klass)
{
}
EOLIAN static void
_object_class_destructor(Eo_Class *klass)
_object_impl_class_destructor(Eo_Class *klass)
{
}

View File

@ -30,9 +30,9 @@ struct _Foo {
#endif
#define DUMMY_CLASS dummy_class_get()
#define STRUCT_CLASS struct_class_get()
const Eo_Class *dummy_class_get(void) EINA_CONST;
const Eo_Class *struct_class_get(void) EINA_CONST;
/**
*
@ -41,7 +41,7 @@ const Eo_Class *dummy_class_get(void) EINA_CONST;
* @param[in] idx No description supplied.
*
*/
EOAPI char * dummy_foo(int idx);
EOAPI char * struct_foo(int idx);
#endif

View File

@ -10,9 +10,9 @@ typedef Eina_List *List_Objects;
#endif
#define DUMMY_CLASS dummy_class_get()
#define TYPEDEF_CLASS typedef_class_get()
const Eo_Class *dummy_class_get(void) EINA_CONST;
const Eo_Class *typedef_class_get(void) EINA_CONST;
/**
*
@ -21,7 +21,7 @@ const Eo_Class *dummy_class_get(void) EINA_CONST;
* @param[in] idx No description supplied.
*
*/
EOAPI char * dummy_foo(int idx);
EOAPI char * typedef_foo(int idx);
#endif