diff options
author | Daniel Zaoui <daniel.zaoui@samsung.com> | 2014-03-26 16:12:39 +0200 |
---|---|---|
committer | Daniel Zaoui <daniel.zaoui@samsung.com> | 2014-03-27 08:52:53 +0200 |
commit | c863154a7956f5af356053094fe50ce52b9a5adb (patch) | |
tree | 8ad574513414e010320bfb44600f849625fd31fc | |
parent | 149509249bdbc6d6ab8fb940ca2829cec6479008 (diff) |
Eolian: fix virtual pure support.
When a property needs be defined as virtual pure, its type could not be
given.
It means that, even it was explicit that e.g only the get property if
virtual pure, both (set and get) were considered as virtual pure.
@fix
-rw-r--r-- | src/bin/eolian/eo1_generator.c | 8 | ||||
-rw-r--r-- | src/lib/eolian/Eolian.h | 2 | ||||
-rw-r--r-- | src/lib/eolian/eo_lexer.c | 2 | ||||
-rw-r--r-- | src/lib/eolian/eo_lexer.rl | 2 | ||||
-rw-r--r-- | src/lib/eolian/eolian_database.c | 23 | ||||
-rw-r--r-- | src/lib/eolian/eolian_database.h | 2 |
6 files changed, 25 insertions, 14 deletions
diff --git a/src/bin/eolian/eo1_generator.c b/src/bin/eolian/eo1_generator.c index d294504038..36cb4fb406 100644 --- a/src/bin/eolian/eo1_generator.c +++ b/src/bin/eolian/eo1_generator.c | |||
@@ -369,7 +369,7 @@ eo1_bind_func_generate(const char *classname, Eolian_Function funcid, Eolian_Fun | |||
369 | Eina_Bool ret_const = EINA_FALSE; | 369 | Eina_Bool ret_const = EINA_FALSE; |
370 | Eina_Bool add_star = EINA_FALSE; | 370 | Eina_Bool add_star = EINA_FALSE; |
371 | 371 | ||
372 | if (!impl_name && eolian_function_is_virtual_pure(funcid)) return EINA_TRUE; | 372 | if (!impl_name && eolian_function_is_virtual_pure(funcid, ftype)) return EINA_TRUE; |
373 | Eina_Strbuf *fbody = eina_strbuf_new(); | 373 | Eina_Strbuf *fbody = eina_strbuf_new(); |
374 | Eina_Strbuf *va_args = eina_strbuf_new(); | 374 | Eina_Strbuf *va_args = eina_strbuf_new(); |
375 | Eina_Strbuf *params = eina_strbuf_new(); /* only variables names */ | 375 | Eina_Strbuf *params = eina_strbuf_new(); /* only variables names */ |
@@ -759,7 +759,7 @@ eo1_source_end_generate(const char *classname, Eina_Strbuf *buf) | |||
759 | eina_strbuf_append(str_op, eina_strbuf_string_get(tmpbuf)); | 759 | eina_strbuf_append(str_op, eina_strbuf_string_get(tmpbuf)); |
760 | free(desc); | 760 | free(desc); |
761 | 761 | ||
762 | if (!eolian_function_is_virtual_pure(fn)) | 762 | if (!eolian_function_is_virtual_pure(fn, SET)) |
763 | eo1_eo_func_desc_generate(classname, NULL, tmpstr, tmpbuf); | 763 | eo1_eo_func_desc_generate(classname, NULL, tmpstr, tmpbuf); |
764 | else | 764 | else |
765 | eina_strbuf_reset(tmpbuf); | 765 | eina_strbuf_reset(tmpbuf); |
@@ -774,7 +774,7 @@ eo1_source_end_generate(const char *classname, Eina_Strbuf *buf) | |||
774 | free(desc); | 774 | free(desc); |
775 | eina_strbuf_append(str_op, eina_strbuf_string_get(tmpbuf)); | 775 | eina_strbuf_append(str_op, eina_strbuf_string_get(tmpbuf)); |
776 | 776 | ||
777 | if (!eolian_function_is_virtual_pure(fn)) | 777 | if (!eolian_function_is_virtual_pure(fn, GET)) |
778 | eo1_eo_func_desc_generate(classname, NULL, tmpstr, tmpbuf); | 778 | eo1_eo_func_desc_generate(classname, NULL, tmpstr, tmpbuf); |
779 | else | 779 | else |
780 | eina_strbuf_reset(tmpbuf); | 780 | eina_strbuf_reset(tmpbuf); |
@@ -792,7 +792,7 @@ eo1_source_end_generate(const char *classname, Eina_Strbuf *buf) | |||
792 | free(desc); | 792 | free(desc); |
793 | eina_strbuf_append(str_op, eina_strbuf_string_get(tmpbuf)); | 793 | eina_strbuf_append(str_op, eina_strbuf_string_get(tmpbuf)); |
794 | 794 | ||
795 | if (!eolian_function_is_virtual_pure(fn)) | 795 | if (!eolian_function_is_virtual_pure(fn, METHOD_FUNC)) |
796 | eo1_eo_func_desc_generate(classname, NULL, funcname, tmpbuf); | 796 | eo1_eo_func_desc_generate(classname, NULL, funcname, tmpbuf); |
797 | else | 797 | else |
798 | eina_strbuf_reset(tmpbuf); | 798 | eina_strbuf_reset(tmpbuf); |
diff --git a/src/lib/eolian/Eolian.h b/src/lib/eolian/Eolian.h index 85a7a93be6..d1b3bc4fe3 100644 --- a/src/lib/eolian/Eolian.h +++ b/src/lib/eolian/Eolian.h | |||
@@ -329,7 +329,7 @@ EAPI const char *eolian_function_data_get(Eolian_Function function_id, const cha | |||
329 | * | 329 | * |
330 | * @ingroup Eolian | 330 | * @ingroup Eolian |
331 | */ | 331 | */ |
332 | EAPI Eina_Bool eolian_function_is_virtual_pure(Eolian_Function function_id); | 332 | EAPI Eina_Bool eolian_function_is_virtual_pure(Eolian_Function function_id, Eolian_Function_Type f_type); |
333 | 333 | ||
334 | /* | 334 | /* |
335 | * @brief Returns a specific description for a function. | 335 | * @brief Returns a specific description for a function. |
diff --git a/src/lib/eolian/eo_lexer.c b/src/lib/eolian/eo_lexer.c index aee2ae4b51..cb0923b69b 100644 --- a/src/lib/eolian/eo_lexer.c +++ b/src/lib/eolian/eo_lexer.c | |||
@@ -4517,7 +4517,7 @@ eo_tokenizer_database_fill(const char *filename) | |||
4517 | ERR("Error - %s not known in class %s", class + 9, kls->name); | 4517 | ERR("Error - %s not known in class %s", class + 9, kls->name); |
4518 | goto end; | 4518 | goto end; |
4519 | } | 4519 | } |
4520 | database_function_set_as_virtual_pure(foo_id); | 4520 | database_function_set_as_virtual_pure(foo_id, ftype); |
4521 | continue; | 4521 | continue; |
4522 | } | 4522 | } |
4523 | Eolian_Implement impl_desc = database_implement_new(class, func, ftype); | 4523 | Eolian_Implement impl_desc = database_implement_new(class, func, ftype); |
diff --git a/src/lib/eolian/eo_lexer.rl b/src/lib/eolian/eo_lexer.rl index 7720302e4a..0a07db90db 100644 --- a/src/lib/eolian/eo_lexer.rl +++ b/src/lib/eolian/eo_lexer.rl | |||
@@ -1490,7 +1490,7 @@ eo_tokenizer_database_fill(const char *filename) | |||
1490 | ERR("Error - %s not known in class %s", class + 9, kls->name); | 1490 | ERR("Error - %s not known in class %s", class + 9, kls->name); |
1491 | goto end; | 1491 | goto end; |
1492 | } | 1492 | } |
1493 | database_function_set_as_virtual_pure(foo_id); | 1493 | database_function_set_as_virtual_pure(foo_id, ftype); |
1494 | continue; | 1494 | continue; |
1495 | } | 1495 | } |
1496 | Eolian_Implement impl_desc = database_implement_new(class, func, ftype); | 1496 | Eolian_Implement impl_desc = database_implement_new(class, func, ftype); |
diff --git a/src/lib/eolian/eolian_database.c b/src/lib/eolian/eolian_database.c index a77759d360..90a073fa6b 100644 --- a/src/lib/eolian/eolian_database.c +++ b/src/lib/eolian/eolian_database.c | |||
@@ -38,7 +38,8 @@ typedef struct | |||
38 | Eolian_Function_Type type; | 38 | Eolian_Function_Type type; |
39 | Eina_Hash *data; | 39 | Eina_Hash *data; |
40 | Eina_Bool obj_is_const :1; /* True if the object has to be const. Useful for a few methods. */ | 40 | Eina_Bool obj_is_const :1; /* True if the object has to be const. Useful for a few methods. */ |
41 | Eina_Bool virtual_pure :1; | 41 | Eina_Bool get_virtual_pure :1; |
42 | Eina_Bool set_virtual_pure :1; | ||
42 | Eina_Bool get_return_warn_unused :1; /* also used for methods */ | 43 | Eina_Bool get_return_warn_unused :1; /* also used for methods */ |
43 | Eina_Bool set_return_warn_unused :1; | 44 | Eina_Bool set_return_warn_unused :1; |
44 | Eina_Bool get_return_own :1; /* also used for methods */ | 45 | Eina_Bool get_return_own :1; /* also used for methods */ |
@@ -551,7 +552,7 @@ eolian_class_function_find_by_name(const char *class_name, const char *func_name | |||
551 | EINA_LIST_FOREACH(desc->properties, itr, foo_id) | 552 | EINA_LIST_FOREACH(desc->properties, itr, foo_id) |
552 | { | 553 | { |
553 | _Function_Id *fid = (_Function_Id *) foo_id; | 554 | _Function_Id *fid = (_Function_Id *) foo_id; |
554 | if (!strcmp(fid->name, func_name) && (f_type == UNRESOLVED || f_type == PROPERTY_FUNC || f_type == fid->type)) | 555 | if (!strcmp(fid->name, func_name)) |
555 | return foo_id; | 556 | return foo_id; |
556 | } | 557 | } |
557 | } | 558 | } |
@@ -631,20 +632,30 @@ eolian_function_name_get(Eolian_Function function_id) | |||
631 | } | 632 | } |
632 | 633 | ||
633 | Eina_Bool | 634 | Eina_Bool |
634 | database_function_set_as_virtual_pure(Eolian_Function function_id) | 635 | database_function_set_as_virtual_pure(Eolian_Function function_id, Eolian_Function_Type ftype) |
635 | { | 636 | { |
636 | _Function_Id *fid = (_Function_Id *)function_id; | 637 | _Function_Id *fid = (_Function_Id *)function_id; |
637 | EINA_SAFETY_ON_NULL_RETURN_VAL(fid, EINA_FALSE); | 638 | EINA_SAFETY_ON_NULL_RETURN_VAL(fid, EINA_FALSE); |
638 | fid->virtual_pure = EINA_TRUE; | 639 | switch (ftype) |
640 | { | ||
641 | case UNRESOLVED: case METHOD_FUNC: case GET: fid->get_virtual_pure = EINA_TRUE; break; | ||
642 | case SET: fid->set_virtual_pure = EINA_TRUE; break; | ||
643 | default: return EINA_FALSE; | ||
644 | } | ||
639 | return EINA_TRUE; | 645 | return EINA_TRUE; |
640 | } | 646 | } |
641 | 647 | ||
642 | EAPI Eina_Bool | 648 | EAPI Eina_Bool |
643 | eolian_function_is_virtual_pure(Eolian_Function function_id) | 649 | eolian_function_is_virtual_pure(Eolian_Function function_id, Eolian_Function_Type ftype) |
644 | { | 650 | { |
645 | _Function_Id *fid = (_Function_Id *)function_id; | 651 | _Function_Id *fid = (_Function_Id *)function_id; |
646 | EINA_SAFETY_ON_NULL_RETURN_VAL(fid, EINA_FALSE); | 652 | EINA_SAFETY_ON_NULL_RETURN_VAL(fid, EINA_FALSE); |
647 | return fid->virtual_pure; | 653 | switch (ftype) |
654 | { | ||
655 | case UNRESOLVED: case METHOD_FUNC: case GET: return fid->get_virtual_pure; break; | ||
656 | case SET: return fid->set_virtual_pure; break; | ||
657 | default: return EINA_FALSE; | ||
658 | } | ||
648 | } | 659 | } |
649 | 660 | ||
650 | void | 661 | void |
diff --git a/src/lib/eolian/eolian_database.h b/src/lib/eolian/eolian_database.h index 8de18ebce8..44ce8ad42f 100644 --- a/src/lib/eolian/eolian_database.h +++ b/src/lib/eolian/eolian_database.h | |||
@@ -105,7 +105,7 @@ void database_function_return_flag_set_own(Eolian_Function foo_id, | |||
105 | void database_function_object_set_as_const(Eolian_Function foo_id, Eina_Bool is_const); | 105 | void database_function_object_set_as_const(Eolian_Function foo_id, Eina_Bool is_const); |
106 | 106 | ||
107 | Eina_Bool | 107 | Eina_Bool |
108 | database_function_set_as_virtual_pure(Eolian_Function function_id); | 108 | database_function_set_as_virtual_pure(Eolian_Function function_id, Eolian_Function_Type type); |
109 | 109 | ||
110 | /* Need to add API for callbacks and implements */ | 110 | /* Need to add API for callbacks and implements */ |
111 | 111 | ||