summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavi Artigas <xavierartigas@yahoo.es>2019-05-28 17:13:49 +0200
committerDaniel Kolesa <d.kolesa@samsung.com>2019-05-28 17:13:49 +0200
commit93909d89e5c77c0b1ae3693b10f4ca89f43fabb5 (patch)
tree2f9cfccad662c22f859579de535907c25b6df2cf
parent7024b19ab140700d6e9f23b2773d24f6673e5e06 (diff)
eolian: allow parts named like methods
Summary: The C# bindings turn parts into class properties, so part names cannot clash with method names. However, a "Part" prefix has been recently added, just like it was done for events, and therefore this eolian restriction can be lifted. With this patch part name clashes are only checked among parts, just like it is done for events. Relates to D8582 Test Plan: Everything still builds, because we have no part-method name clashes in the tree, but now they are possible. Reviewers: q66, SanghyeonLee Reviewed By: q66 Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D9031
-rw-r--r--src/lib/eolian/database_validate.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/src/lib/eolian/database_validate.c b/src/lib/eolian/database_validate.c
index cc1ad5ad7c..9026f38247 100644
--- a/src/lib/eolian/database_validate.c
+++ b/src/lib/eolian/database_validate.c
@@ -461,13 +461,13 @@ _validate_function(Validate_State *vals, Eolian_Function *func, Eina_Hash *nhash
461} 461}
462 462
463static Eina_Bool 463static Eina_Bool
464_validate_part(Validate_State *vals, Eolian_Part *part, Eina_Hash *nhash) 464_validate_part(Validate_State *vals, Eolian_Part *part, Eina_Hash *phash)
465{ 465{
466 const Eolian_Object *oobj = eina_hash_find(nhash, &part->base.name); 466 const Eolian_Object *oobj = eina_hash_find(phash, &part->base.name);
467 if (oobj) 467 if (oobj)
468 { 468 {
469 _eo_parser_log(&part->base, 469 _eo_parser_log(&part->base,
470 "part '%s' conflicts with another symbol (at %s:%d:%d)", 470 "part '%s' conflicts with another part (at %s:%d:%d)",
471 part->base.name, oobj->file, oobj->line, oobj->column); 471 part->base.name, oobj->file, oobj->line, oobj->column);
472 vals->warned = EINA_TRUE; 472 vals->warned = EINA_TRUE;
473 } 473 }
@@ -476,7 +476,7 @@ _validate_part(Validate_State *vals, Eolian_Part *part, Eina_Hash *nhash)
476 if (part->base.validated) 476 if (part->base.validated)
477 { 477 {
478 if (!oobj) 478 if (!oobj)
479 eina_hash_add(nhash, &part->base.name, &part->base); 479 eina_hash_add(phash, &part->base.name, &part->base);
480 return EINA_TRUE; 480 return EINA_TRUE;
481 } 481 }
482 482
@@ -503,7 +503,7 @@ _validate_part(Validate_State *vals, Eolian_Part *part, Eina_Hash *nhash)
503 part->klass = pcl; 503 part->klass = pcl;
504 504
505 if (!oobj) 505 if (!oobj)
506 eina_hash_add(nhash, &part->base.name, &part->base); 506 eina_hash_add(phash, &part->base.name, &part->base);
507 507
508 _reset_stable(vals, was_stable, EINA_TRUE); 508 _reset_stable(vals, was_stable, EINA_TRUE);
509 return _validate(&part->base); 509 return _validate(&part->base);
@@ -1232,7 +1232,7 @@ _required_classes(Eolian_Class *mixin)
1232 1232
1233static Eina_Bool 1233static Eina_Bool
1234_validate_class(Validate_State *vals, Eolian_Class *cl, 1234_validate_class(Validate_State *vals, Eolian_Class *cl,
1235 Eina_Hash *nhash, Eina_Hash *ehash, Eina_Hash *chash) 1235 Eina_Hash *nhash, Eina_Hash *ehash, Eina_Hash *phash, Eina_Hash *chash)
1236{ 1236{
1237 Eina_List *l; 1237 Eina_List *l;
1238 Eolian_Function *func; 1238 Eolian_Function *func;
@@ -1273,7 +1273,7 @@ _validate_class(Validate_State *vals, Eolian_Class *cl,
1273 _eo_parser_log(&cl->base, "non-beta class cannot have beta parent"); 1273 _eo_parser_log(&cl->base, "non-beta class cannot have beta parent");
1274 return EINA_FALSE; 1274 return EINA_FALSE;
1275 } 1275 }
1276 if (!_validate_class(vals, cl->parent, nhash, ehash, chash)) 1276 if (!_validate_class(vals, cl->parent, nhash, ehash, phash, chash))
1277 return EINA_FALSE; 1277 return EINA_FALSE;
1278 } 1278 }
1279 1279
@@ -1305,7 +1305,7 @@ _validate_class(Validate_State *vals, Eolian_Class *cl,
1305 /* it's ok, interfaces are allowed */ 1305 /* it's ok, interfaces are allowed */
1306 break; 1306 break;
1307 } 1307 }
1308 if (!_validate_class(vals, icl, nhash, ehash, chash)) 1308 if (!_validate_class(vals, icl, nhash, ehash, phash, chash))
1309 return EINA_FALSE; 1309 return EINA_FALSE;
1310 } 1310 }
1311 if (cl->type == EOLIAN_CLASS_ABSTRACT || cl->type == EOLIAN_CLASS_REGULAR) 1311 if (cl->type == EOLIAN_CLASS_ABSTRACT || cl->type == EOLIAN_CLASS_REGULAR)
@@ -1350,7 +1350,7 @@ _validate_class(Validate_State *vals, Eolian_Class *cl,
1350 return EINA_FALSE; 1350 return EINA_FALSE;
1351 1351
1352 EINA_LIST_FOREACH(cl->parts, l, part) 1352 EINA_LIST_FOREACH(cl->parts, l, part)
1353 if (!_validate_part(vals, part, nhash)) 1353 if (!_validate_part(vals, part, phash))
1354 return EINA_FALSE; 1354 return EINA_FALSE;
1355 1355
1356 EINA_LIST_FOREACH(cl->implements, l, impl) 1356 EINA_LIST_FOREACH(cl->implements, l, impl)
@@ -1446,22 +1446,26 @@ database_validate(const Eolian_Unit *src)
1446 iter = eolian_unit_classes_get(src); 1446 iter = eolian_unit_classes_get(src);
1447 Eina_Hash *nhash = eina_hash_pointer_new(NULL); 1447 Eina_Hash *nhash = eina_hash_pointer_new(NULL);
1448 Eina_Hash *ehash = eina_hash_pointer_new(NULL); 1448 Eina_Hash *ehash = eina_hash_pointer_new(NULL);
1449 Eina_Hash *phash = eina_hash_pointer_new(NULL);
1449 Eina_Hash *chash = eina_hash_pointer_new(NULL); 1450 Eina_Hash *chash = eina_hash_pointer_new(NULL);
1450 EINA_ITERATOR_FOREACH(iter, cl) 1451 EINA_ITERATOR_FOREACH(iter, cl)
1451 { 1452 {
1452 eina_hash_free_buckets(nhash); 1453 eina_hash_free_buckets(nhash);
1453 eina_hash_free_buckets(ehash); 1454 eina_hash_free_buckets(ehash);
1455 eina_hash_free_buckets(phash);
1454 eina_hash_free_buckets(chash); 1456 eina_hash_free_buckets(chash);
1455 if (!_validate_class(&vals, cl, nhash, ehash, chash)) 1457 if (!_validate_class(&vals, cl, nhash, ehash, phash, chash))
1456 { 1458 {
1457 eina_iterator_free(iter); 1459 eina_iterator_free(iter);
1458 eina_hash_free(nhash); 1460 eina_hash_free(nhash);
1459 eina_hash_free(ehash); 1461 eina_hash_free(ehash);
1462 eina_hash_free(phash);
1460 eina_hash_free(chash); 1463 eina_hash_free(chash);
1461 return EINA_FALSE; 1464 return EINA_FALSE;
1462 } 1465 }
1463 } 1466 }
1464 eina_hash_free(chash); 1467 eina_hash_free(chash);
1468 eina_hash_free(phash);
1465 eina_hash_free(ehash); 1469 eina_hash_free(ehash);
1466 eina_hash_free(nhash); 1470 eina_hash_free(nhash);
1467 eina_iterator_free(iter); 1471 eina_iterator_free(iter);