summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@osg.samsung.com>2017-09-15 16:30:52 +0200
committerDaniel Kolesa <d.kolesa@osg.samsung.com>2017-09-15 16:30:52 +0200
commit010650663b4abe5954b0deea3708d905cb87a615 (patch)
treed81fdc3392a665026b68a63a27633ae219354f57 /src/lib
parent792855a1fac723e13efb11acd9287053e18a2ec9 (diff)
eolian: store ownership info in types
Even though ownership info belongs to params/returns/etc at syntax level, we can still store it in the type and turn several API funcs into one this way.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/eolian/eo_parser.c13
-rw-r--r--src/lib/eolian/eolian_database.h5
2 files changed, 6 insertions, 12 deletions
diff --git a/src/lib/eolian/eo_parser.c b/src/lib/eolian/eo_parser.c
index 791fcce..4126323 100644
--- a/src/lib/eolian/eo_parser.c
+++ b/src/lib/eolian/eo_parser.c
@@ -517,7 +517,7 @@ parse_struct(Eo_Lexer *ls, const char *name, Eina_Bool is_extern,
517 fdef->type = tp; 517 fdef->type = tp;
518 fdef->name = eina_stringshare_ref(fname); 518 fdef->name = eina_stringshare_ref(fname);
519 pop_type(ls); 519 pop_type(ls);
520 if ((fdef->owned = (ls->t.kw == KW_at_owned))) 520 if ((fdef->type->owned = (ls->t.kw == KW_at_owned)))
521 eo_lexer_get(ls); 521 eo_lexer_get(ls);
522 check_next(ls, ';'); 522 check_next(ls, ';');
523 FILL_DOC(ls, fdef, doc); 523 FILL_DOC(ls, fdef, doc);
@@ -1085,7 +1085,7 @@ parse_param(Eo_Lexer *ls, Eina_List **params, Eina_Bool allow_inout,
1085 break; 1085 break;
1086 case KW_at_owned: 1086 case KW_at_owned:
1087 CASE_LOCK(ls, owned, "owned qualifier"); 1087 CASE_LOCK(ls, owned, "owned qualifier");
1088 par->owned = EINA_TRUE; 1088 par->type->owned = EINA_TRUE;
1089 eo_lexer_get(ls); 1089 eo_lexer_get(ls);
1090 break; 1090 break;
1091 default: 1091 default:
@@ -1201,7 +1201,7 @@ parse_accessor:
1201 prop->get_return_doc = ret.doc; 1201 prop->get_return_doc = ret.doc;
1202 prop->get_ret_val = ret.default_ret_val; 1202 prop->get_ret_val = ret.default_ret_val;
1203 prop->get_return_warn_unused = ret.warn_unused; 1203 prop->get_return_warn_unused = ret.warn_unused;
1204 prop->get_return_owned = ret.owned; 1204 prop->get_ret_type->owned = ret.owned;
1205 } 1205 }
1206 else 1206 else
1207 { 1207 {
@@ -1209,7 +1209,7 @@ parse_accessor:
1209 prop->set_return_doc = ret.doc; 1209 prop->set_return_doc = ret.doc;
1210 prop->set_ret_val = ret.default_ret_val; 1210 prop->set_ret_val = ret.default_ret_val;
1211 prop->set_return_warn_unused = ret.warn_unused; 1211 prop->set_return_warn_unused = ret.warn_unused;
1212 prop->set_return_owned = ret.owned; 1212 prop->set_ret_type->owned = ret.owned;
1213 } 1213 }
1214 break; 1214 break;
1215 case KW_legacy: 1215 case KW_legacy:
@@ -1413,7 +1413,6 @@ parse_function_pointer(Eo_Lexer *ls)
1413 meth->get_return_doc = ret.doc; 1413 meth->get_return_doc = ret.doc;
1414 meth->get_ret_val = NULL; 1414 meth->get_ret_val = NULL;
1415 meth->get_return_warn_unused = EINA_FALSE; 1415 meth->get_return_warn_unused = EINA_FALSE;
1416 meth->get_return_owned = EINA_FALSE;
1417 break; 1416 break;
1418 case KW_params: 1417 case KW_params:
1419 CASE_LOCK(ls, params, "params definition"); 1418 CASE_LOCK(ls, params, "params definition");
@@ -1508,7 +1507,7 @@ body:
1508 meth->get_return_doc = ret.doc; 1507 meth->get_return_doc = ret.doc;
1509 meth->get_ret_val = ret.default_ret_val; 1508 meth->get_ret_val = ret.default_ret_val;
1510 meth->get_return_warn_unused = ret.warn_unused; 1509 meth->get_return_warn_unused = ret.warn_unused;
1511 meth->get_return_owned = ret.owned; 1510 meth->get_ret_type->owned = ret.owned;
1512 break; 1511 break;
1513 case KW_legacy: 1512 case KW_legacy:
1514 CASE_LOCK(ls, legacy, "legacy name") 1513 CASE_LOCK(ls, legacy, "legacy name")
@@ -1800,7 +1799,6 @@ parse_event(Eo_Lexer *ls)
1800 break; 1799 break;
1801 case KW_at_owned: 1800 case KW_at_owned:
1802 CASE_LOCK(ls, owned, "owned qualifier"); 1801 CASE_LOCK(ls, owned, "owned qualifier");
1803 ev->owned = EINA_TRUE;
1804 eo_lexer_get(ls); 1802 eo_lexer_get(ls);
1805 break; 1803 break;
1806 default: 1804 default:
@@ -1811,6 +1809,7 @@ end:
1811 { 1809 {
1812 eo_lexer_get(ls); 1810 eo_lexer_get(ls);
1813 ev->type = parse_type(ls, EINA_TRUE, EINA_FALSE); 1811 ev->type = parse_type(ls, EINA_TRUE, EINA_FALSE);
1812 ev->type->owned = has_owned;
1814 pop_type(ls); 1813 pop_type(ls);
1815 } 1814 }
1816 check(ls, ';'); 1815 check(ls, ';');
diff --git a/src/lib/eolian/eolian_database.h b/src/lib/eolian/eolian_database.h
index 313779c..47367f4 100644
--- a/src/lib/eolian/eolian_database.h
+++ b/src/lib/eolian/eolian_database.h
@@ -131,8 +131,6 @@ struct _Eolian_Function
131 Eina_Bool obj_is_const :1; /* True if the object has to be const. Useful for a few methods. */ 131 Eina_Bool obj_is_const :1; /* True if the object has to be const. Useful for a few methods. */
132 Eina_Bool get_return_warn_unused :1; /* also used for methods */ 132 Eina_Bool get_return_warn_unused :1; /* also used for methods */
133 Eina_Bool set_return_warn_unused :1; 133 Eina_Bool set_return_warn_unused :1;
134 Eina_Bool get_return_owned :1;
135 Eina_Bool set_return_owned :1;
136 Eina_Bool get_only_legacy: 1; 134 Eina_Bool get_only_legacy: 1;
137 Eina_Bool set_only_legacy: 1; 135 Eina_Bool set_only_legacy: 1;
138 Eina_Bool is_class :1; 136 Eina_Bool is_class :1;
@@ -152,7 +150,6 @@ struct _Eolian_Function_Parameter
152 Eina_Bool nonull :1; /* True if this argument cannot be NULL - deprecated */ 150 Eina_Bool nonull :1; /* True if this argument cannot be NULL - deprecated */
153 Eina_Bool nullable :1; /* True if this argument is nullable */ 151 Eina_Bool nullable :1; /* True if this argument is nullable */
154 Eina_Bool optional :1; /* True if this argument is optional */ 152 Eina_Bool optional :1; /* True if this argument is optional */
155 Eina_Bool owned :1;
156}; 153};
157 154
158struct _Eolian_Type 155struct _Eolian_Type
@@ -227,7 +224,6 @@ struct _Eolian_Event
227 Eina_Bool is_beta :1; 224 Eina_Bool is_beta :1;
228 Eina_Bool is_hot :1; 225 Eina_Bool is_hot :1;
229 Eina_Bool is_restart :1; 226 Eina_Bool is_restart :1;
230 Eina_Bool owned :1;
231}; 227};
232 228
233struct _Eolian_Struct_Type_Field 229struct _Eolian_Struct_Type_Field
@@ -236,7 +232,6 @@ struct _Eolian_Struct_Type_Field
236 Eolian_Object base; 232 Eolian_Object base;
237 Eolian_Type *type; 233 Eolian_Type *type;
238 Eolian_Documentation *doc; 234 Eolian_Documentation *doc;
239 Eina_Bool owned :1;
240}; 235};
241 236
242struct _Eolian_Enum_Type_Field 237struct _Eolian_Enum_Type_Field