summaryrefslogtreecommitdiff
path: root/src/lib/eolian
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@samsung.com>2019-08-31 02:04:13 +0200
committerDaniel Kolesa <d.kolesa@samsung.com>2019-08-31 02:13:59 +0200
commit242bad209b23098027b94528d81ead63e10461f3 (patch)
tree64d7d1e79c00507b783f46ee2e3736e6caf4dadd /src/lib/eolian
parent5e5bfc70e5d52a2779473127a0f1ccdc92588de9 (diff)
eolian: add API to check if an inner type of complex type is @move
This complements the equivalent APIs of parameters and so on. It is not the same as the older type_is_owned API, which applied to everything.
Diffstat (limited to 'src/lib/eolian')
-rw-r--r--src/lib/eolian/Eolian.h15
-rw-r--r--src/lib/eolian/database_type_api.c7
-rw-r--r--src/lib/eolian/eo_parser.c4
-rw-r--r--src/lib/eolian/eolian_database.h1
4 files changed, 25 insertions, 2 deletions
diff --git a/src/lib/eolian/Eolian.h b/src/lib/eolian/Eolian.h
index f92830e64f..b054792e29 100644
--- a/src/lib/eolian/Eolian.h
+++ b/src/lib/eolian/Eolian.h
@@ -2916,6 +2916,21 @@ EAPI const Eolian_Error *eolian_type_error_get(const Eolian_Type *tp);
2916EAPI Eina_Bool eolian_type_is_owned(const Eolian_Type *tp); 2916EAPI Eina_Bool eolian_type_is_owned(const Eolian_Type *tp);
2917 2917
2918/* 2918/*
2919 * @brief Get whether the given type is moved with its parent type.
2920 *
2921 * This is only used for inner types of complex types, i.e. the types
2922 * inside the brackets of lists, arrays, hashes and so on. You can use
2923 * this to tell whether they belong to their parent type (i.e. whether
2924 * they are marked @move).
2925 *
2926 * @param[in] tp the type.
2927 * @return EINA_TRUE when the type is marked move, EINA_FALSE otherwise.
2928 *
2929 * @ingroup Eolian
2930 */
2931EAPI Eina_Bool eolian_type_is_move(const Eolian_Type *tp);
2932
2933/*
2919 * @brief Get whether the given type is const. 2934 * @brief Get whether the given type is const.
2920 * 2935 *
2921 * @param[in] tp the type. 2936 * @param[in] tp the type.
diff --git a/src/lib/eolian/database_type_api.c b/src/lib/eolian/database_type_api.c
index 39ba042a2b..2bec505ca0 100644
--- a/src/lib/eolian/database_type_api.c
+++ b/src/lib/eolian/database_type_api.c
@@ -228,6 +228,13 @@ eolian_type_is_owned(const Eolian_Type *tp)
228} 228}
229 229
230EAPI Eina_Bool 230EAPI Eina_Bool
231eolian_type_is_move(const Eolian_Type *tp)
232{
233 EINA_SAFETY_ON_NULL_RETURN_VAL(tp, EINA_FALSE);
234 return tp->move;
235}
236
237EAPI Eina_Bool
231eolian_type_is_const(const Eolian_Type *tp) 238eolian_type_is_const(const Eolian_Type *tp)
232{ 239{
233 EINA_SAFETY_ON_NULL_RETURN_VAL(tp, EINA_FALSE); 240 EINA_SAFETY_ON_NULL_RETURN_VAL(tp, EINA_FALSE);
diff --git a/src/lib/eolian/eo_parser.c b/src/lib/eolian/eo_parser.c
index e69989aa8c..70ae08b1f8 100644
--- a/src/lib/eolian/eo_parser.c
+++ b/src/lib/eolian/eo_parser.c
@@ -774,14 +774,14 @@ parse_type_void(Eo_Lexer *ls, Eina_Bool allow_ptr)
774 def->base_type = eo_lexer_type_release(ls, parse_type(ls, EINA_TRUE)); 774 def->base_type = eo_lexer_type_release(ls, parse_type(ls, EINA_TRUE));
775 /* view-only types are not allowed to own the contents */ 775 /* view-only types are not allowed to own the contents */
776 if (tpid == KW_array || tpid == KW_hash || tpid == KW_list || tpid == KW_future) 776 if (tpid == KW_array || tpid == KW_hash || tpid == KW_list || tpid == KW_future)
777 if ((def->base_type->owned = (ls->t.kw == KW_at_owned || ls->t.kw == KW_at_move))) 777 if ((def->base_type->owned = def->base_type->move = (ls->t.kw == KW_at_owned || ls->t.kw == KW_at_move)))
778 eo_lexer_get(ls); 778 eo_lexer_get(ls);
779 if (tpid == KW_hash) 779 if (tpid == KW_hash)
780 { 780 {
781 check_next(ls, ','); 781 check_next(ls, ',');
782 def->base_type->next_type = 782 def->base_type->next_type =
783 eo_lexer_type_release(ls, parse_type(ls, EINA_TRUE)); 783 eo_lexer_type_release(ls, parse_type(ls, EINA_TRUE));
784 if ((def->base_type->next_type->owned = (ls->t.kw == KW_at_owned || ls->t.kw == KW_at_move))) 784 if ((def->base_type->next_type->owned = def->base_type->move = (ls->t.kw == KW_at_owned || ls->t.kw == KW_at_move)))
785 eo_lexer_get(ls); 785 eo_lexer_get(ls);
786 } 786 }
787 check_match(ls, '>', '<', bline, bcol); 787 check_match(ls, '>', '<', bline, bcol);
diff --git a/src/lib/eolian/eolian_database.h b/src/lib/eolian/eolian_database.h
index e66543f6bd..8f67ab5dc5 100644
--- a/src/lib/eolian/eolian_database.h
+++ b/src/lib/eolian/eolian_database.h
@@ -278,6 +278,7 @@ struct _Eolian_Type
278 }; 278 };
279 Eina_Bool is_const :1; 279 Eina_Bool is_const :1;
280 Eina_Bool is_ptr :1; 280 Eina_Bool is_ptr :1;
281 Eina_Bool move :1;
281 Eina_Bool owned :1; 282 Eina_Bool owned :1;
282 Eina_Bool ownable :1; 283 Eina_Bool ownable :1;
283}; 284};