This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch eolian/improvements
in repository efl.

View the commit online.

commit f11b83d91f8d3c5a76b4c96b3c42f8f746975aaa
Author: [email protected] <[email protected]>
AuthorDate: Thu Nov 5 23:10:05 2026 -0600

    eolian: events can name the properties they notify
    
    Bindings that expose properties as reactive values need to know which
    event announces a change of which property, and whether the change is
    confirmed asynchronously. Today that link only lives in documentation.
    
    Add the event qualifier @notify(name[, name...]), where each name is a
    property of the event's class or of a class it inherits or extends, or a
    qualified Class.Name.prop, and a separate flag qualifier @deferred. Both
    combine with @beta, @hot and @restart in any order, once each.
    
    Validation resolves every name to a property getter and refuses unknown
    names, methods, properties without a getter, beta properties on a stable
    event and duplicates, with the .eo file and line. The API is
    eolian_event_notified_properties_get() and
    eolian_event_notify_is_deferred(), also exposed in pyolian.
    
    Also free the dtor records the lexer leaves behind when a parse aborts,
    which the new failure fixtures exposed under valgrind.
    
    Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
---
 doc/eolian/grammar.md                           |   4 +
 src/lib/eolian/Eolian.h                         |  33 +++++++
 src/lib/eolian/database_event.c                 |   5 +
 src/lib/eolian/database_event_api.c             |  14 +++
 src/lib/eolian/database_validate.c              |  75 +++++++++++++++
 src/lib/eolian/eo_lexer.c                       |   5 +-
 src/lib/eolian/eo_lexer.h                       |   4 +-
 src/lib/eolian/eo_parser.c                      |  45 ++++++++-
 src/lib/eolian/eolian_database.h                |   3 +
 src/scripts/pyolian/eolian.py                   |   8 ++
 src/scripts/pyolian/eolian_lib.py               |   8 ++
 src/scripts/pyolian/test_eolian.py              |  21 +++++
 src/tests/eolian/data/notify.eo                 |  30 ++++++
 src/tests/eolian/data/notify_bad_class.eo       |  27 ++++++
 src/tests/eolian/data/notify_base.eo            |  12 +++
 src/tests/eolian/data/notify_beta.eo            |  27 ++++++
 src/tests/eolian/data/notify_double.eo          |  27 ++++++
 src/tests/eolian/data/notify_double_deferred.eo |  27 ++++++
 src/tests/eolian/data/notify_dup.eo             |  27 ++++++
 src/tests/eolian/data/notify_empty.eo           |  27 ++++++
 src/tests/eolian/data/notify_method.eo          |  27 ++++++
 src/tests/eolian/data/notify_no_getter.eo       |  27 ++++++
 src/tests/eolian/data/notify_ok_beta.eo         |  27 ++++++
 src/tests/eolian/data/notify_unknown.eo         |  27 ++++++
 src/tests/eolian/eolian_parsing.c               | 117 ++++++++++++++++++++++++
 25 files changed, 650 insertions(+), 4 deletions(-)

diff --git a/doc/eolian/grammar.md b/doc/eolian/grammar.md
index bd813f220e..5269d489a2 100644
--- a/doc/eolian/grammar.md
+++ b/doc/eolian/grammar.md
@@ -357,6 +357,8 @@ events {
    changed: Efl.Gfx.Entity @nullable;     [[The new value, or $NULL.]]
    pressed @hot @protected: Efl.Input.Key; [[Cannot be frozen.]]
    restarted @restart: void;
+   changed @notify(value): void;                    [[The `value` property changed.]]
+   resized @notify(Efl.Gfx.Entity.size) @deferred: void;
 }
 ```
 
@@ -365,6 +367,8 @@ events {
 | `@beta` | not stable API |
 | `@hot` | cannot be frozen by event freezing |
 | `@restart` | restarts event propagation |
+| `@notify(name, ...)` | the event announces a change of these properties; each name is a property of the class or of a class it inherits or extends, or a qualified `Class.Name.prop`. Each must have a getter, be non-beta when the event is stable, and appear once. Since 1.30 |
+| `@deferred` | the change is confirmed asynchronously, after the setter may have returned. Since 1.30 |
 | `@private`, `@protected` | scope |
 | `@nullable` | the payload may be `NULL` — goes *after* the type, since it describes the payload |
 
diff --git a/src/lib/eolian/Eolian.h b/src/lib/eolian/Eolian.h
index 83d6d12b40..53e0afc957 100644
--- a/src/lib/eolian/Eolian.h
+++ b/src/lib/eolian/Eolian.h
@@ -2377,6 +2377,39 @@ EOLIAN_API Eina_Bool eolian_event_is_nullable(const Eolian_Event *event);
  */
 EOLIAN_API Eina_Bool eolian_event_is_restart(const Eolian_Event *event);
 
+/*
+ * @brief Get the properties an event announces a change of.
+ *
+ * @param[in] event the event handle
+ * @return an iterator over const Eolian_Function* (properties with a getter),
+ *         in declaration order; empty when the event has no @notify qualifier
+ *
+ * The properties come from @notify(name, ...) and belong to the event's class
+ * or to a class it inherits or extends. Validation guarantees each one is a
+ * property with a getter, and is not beta unless the event is.
+ *
+ * @since 1.30
+ *
+ * @ingroup Eolian
+ */
+EOLIAN_API Eina_Iterator *eolian_event_notified_properties_get(const Eolian_Event *event);
+
+/*
+ * @brief Get whether the notified properties are confirmed asynchronously.
+ *
+ * @param[in] event the event handle
+ * @return EINA_TRUE for events marked @deferred, EINA_FALSE otherwise
+ *
+ * A deferred event fires once the new value has been applied, which can be
+ * after the setter returned, so reading the property right after setting it
+ * may still give the old value.
+ *
+ * @since 1.30
+ *
+ * @ingroup Eolian
+ */
+EOLIAN_API Eina_Bool eolian_event_notify_is_deferred(const Eolian_Event *event);
+
 /*
  * @brief Get an iterator to the parts defined in a class.
  *
diff --git a/src/lib/eolian/database_event.c b/src/lib/eolian/database_event.c
index 6513787ea8..01fbfb92cb 100644
--- a/src/lib/eolian/database_event.c
+++ b/src/lib/eolian/database_event.c
@@ -11,6 +11,11 @@ database_event_del(Eolian_Event *event)
    if (!event) return;
    eina_stringshare_del(event->base.file);
    eina_stringshare_del(event->base.name);
+   {
+      Eina_Stringshare *name;
+      EINA_LIST_FREE(event->notify_names, name) eina_stringshare_del(name);
+      eina_list_free(event->notified);
+   }
    database_type_del(event->type);
    database_doc_del(event->doc);
    free(event);
diff --git a/src/lib/eolian/database_event_api.c b/src/lib/eolian/database_event_api.c
index a61c88a2a6..f881cac9d9 100644
--- a/src/lib/eolian/database_event_api.c
+++ b/src/lib/eolian/database_event_api.c
@@ -56,6 +56,20 @@ eolian_event_is_restart(const Eolian_Event *event)
    return event->is_restart;
 }
 
+EOLIAN_API Eina_Iterator *
+eolian_event_notified_properties_get(const Eolian_Event *event)
+{
+   EINA_SAFETY_ON_NULL_RETURN_VAL(event, NULL);
+   return eina_list_iterator_new(event->notified);
+}
+
+EOLIAN_API Eina_Bool
+eolian_event_notify_is_deferred(const Eolian_Event *event)
+{
+   EINA_SAFETY_ON_NULL_RETURN_VAL(event, EINA_FALSE);
+   return event->is_deferred;
+}
+
 EOLIAN_API Eina_Stringshare *
 eolian_event_c_macro_get(const Eolian_Event *event)
 {
diff --git a/src/lib/eolian/database_validate.c b/src/lib/eolian/database_validate.c
index 472ab1eed0..f4b4bf7f60 100644
--- a/src/lib/eolian/database_validate.c
+++ b/src/lib/eolian/database_validate.c
@@ -739,6 +739,78 @@ _validate_style(Validate_State *vals, Eolian_Style *style, Eina_Hash *shash)
    return _validate(&style->base);
 }
 
+/* Looks name up in klass and everything it inherits or extends. A qualified
+ * name (Class.Name.prop) only matches the property of that class. */
+static Eolian_Function *
+_notify_lookup(const Eolian_Class *klass, const char *cname, size_t clen,
+               const char *pname, Eina_Bool *is_method)
+{
+   Eina_List *l;
+   Eolian_Function *func;
+   Eolian_Class *icl;
+
+   if (!clen || (!strncmp(klass->base.name, cname, clen) && !klass->base.name[clen]))
+     {
+        EINA_LIST_FOREACH(klass->properties, l, func)
+          if (!strcmp(func->base.name, pname))
+            return func;
+        EINA_LIST_FOREACH(klass->methods, l, func)
+          if (!strcmp(func->base.name, pname))
+            *is_method = EINA_TRUE;
+     }
+   if (klass->parent && (func = _notify_lookup(klass->parent, cname, clen, pname, is_method)))
+     return func;
+   EINA_LIST_FOREACH(klass->extends, l, icl)
+     if ((func = _notify_lookup(icl, cname, clen, pname, is_method)))
+       return func;
+   return NULL;
+}
+
+static Eina_Bool
+_validate_event_notify(Validate_State *vals, Eolian_Event *event)
+{
+   Eina_List *l;
+   Eina_Stringshare *name;
+
+   event->notified = eina_list_free(event->notified);
+   EINA_LIST_FOREACH(event->notify_names, l, name)
+     {
+        Eina_Bool is_method = EINA_FALSE;
+        const char *dot = strrchr(name, '.');
+        const char *pname = dot ? dot + 1 : name;
+        Eolian_Function *func = _notify_lookup(event->klass, name,
+                                               dot ? (size_t)(dot - name) : 0,
+                                               pname, &is_method);
+        if (!func)
+          {
+             if (is_method)
+               _eo_parser_log(&event->base, "@notify name '%s' is a method, not a property", name);
+             else
+               _eo_parser_log(&event->base, "@notify: no property '%s' in class '%s' or the classes it inherits",
+                              name, event->klass->base.name);
+             return EINA_FALSE;
+          }
+        if (func->type != EOLIAN_PROPERTY && func->type != EOLIAN_PROP_GET)
+          {
+             _eo_parser_log(&event->base, "@notify property '%s' has no getter", name);
+             return EINA_FALSE;
+          }
+        if (func->base.is_beta && vals->stable)
+          {
+             _eo_parser_log(&event->base, "@notify property '%s' is beta but event '%s' is stable",
+                            name, event->base.name);
+             return EINA_FALSE;
+          }
+        if (eina_list_data_find(event->notified, func))
+          {
+             _eo_parser_log(&event->base, "@notify names property '%s' twice", name);
+             return EINA_FALSE;
+          }
+        event->notified = eina_list_append(event->notified, func);
+     }
+   return EINA_TRUE;
+}
+
 static Eina_Bool
 _validate_event(Validate_State *vals, Eolian_Event *event, Eina_Hash *nhash)
 {
@@ -831,6 +903,9 @@ _validate_event(Validate_State *vals, Eolian_Event *event, Eina_Hash *nhash)
           }
      }
 
+   if (!_validate_event_notify(vals, event))
+     return _reset_stable(vals, was_stable, EINA_FALSE);
+
    if (!_validate_doc(event->doc))
      return _reset_stable(vals, was_stable, EINA_FALSE);
    if (!_validate_doc_since_reset(vals, event->doc))
diff --git a/src/lib/eolian/eo_lexer.c b/src/lib/eolian/eo_lexer.c
index ce54877747..830b6219af 100644
--- a/src/lib/eolian/eo_lexer.c
+++ b/src/lib/eolian/eo_lexer.c
@@ -1190,7 +1190,10 @@ eo_lexer_free(Eo_Lexer *ls)
 
    Eo_Lexer_Dtor *dtor;
    EINA_LIST_FREE(ls->dtors, dtor)
-     dtor->free_cb(dtor->data);
+     {
+        dtor->free_cb(dtor->data);
+        free(dtor);
+     }
 
    eina_hash_free(ls->nodes);
 
diff --git a/src/lib/eolian/eo_lexer.h b/src/lib/eolian/eo_lexer.h
index cbcca174d1..3120f2c7ec 100644
--- a/src/lib/eolian/eo_lexer.h
+++ b/src/lib/eolian/eo_lexer.h
@@ -32,8 +32,8 @@ enum Tokens
     KW(parse), KW(parts), KW(styles), KW(ptr), KW(set), KW(type), KW(values), KW(requires), \
     \
     KWAT(auto), KWAT(beta), KWAT(by_ref), KWAT(c_name), KWAT(const), KWAT(construct_only), \
-    KWAT(deprecated), KWAT(empty), KWAT(extern), KWAT(free), KWAT(hot), KWAT(in), KWAT(inout), \
-    KWAT(move), KWAT(no_unused), KWAT(nullable), KWAT(optional), KWAT(out), \
+    KWAT(deferred), KWAT(deprecated), KWAT(empty), KWAT(extern), KWAT(free), KWAT(hot), KWAT(in), KWAT(inout), \
+    KWAT(move), KWAT(no_unused), KWAT(notify), KWAT(nullable), KWAT(optional), KWAT(out), \
     KWAT(private), KWAT(property), KWAT(protected), KWAT(restart), \
     KWAT(pure_virtual), KWAT(static), \
     \
diff --git a/src/lib/eolian/eo_parser.c b/src/lib/eolian/eo_parser.c
index 79eae658da..17964a8d3a 100644
--- a/src/lib/eolian/eo_parser.c
+++ b/src/lib/eolian/eo_parser.c
@@ -1900,6 +1900,39 @@ parse_constructor(Eo_Lexer *ls)
    eo_lexer_dtor_pop(ls);
 }
 
+/* @notify(name[, name...]): each name is a property name or Class.Name.prop.
+ * They are only recorded here; validation resolves them against the class. */
+static void
+parse_event_notify(Eo_Lexer *ls, Eolian_Event *ev)
+{
+   int pline, pcol;
+   Eina_Strbuf *buf = eina_strbuf_new();
+   eo_lexer_dtor_push(ls, EINA_FREE_CB(eina_strbuf_free), buf);
+   eo_lexer_get(ls);
+   pline = ls->line_number, pcol = ls->column;
+   check_next(ls, '(');
+   for (;;)
+     {
+        check(ls, TOK_VALUE);
+        eina_strbuf_reset(buf);
+        for (;;)
+          {
+             eina_strbuf_append(buf, ls->t.value.s);
+             eo_lexer_get(ls);
+             if (ls->t.token != '.') break;
+             eo_lexer_get(ls);
+             eina_strbuf_append_char(buf, '.');
+             check(ls, TOK_VALUE);
+          }
+        ev->notify_names = eina_list_append(ev->notify_names,
+          eina_stringshare_add(eina_strbuf_string_get(buf)));
+        if (ls->t.token != ',') break;
+        eo_lexer_get(ls);
+     }
+   check_match(ls, ')', '(', pline, pcol);
+   eo_lexer_dtor_pop(ls);
+}
+
 static void
 parse_event(Eo_Lexer *ls)
 {
@@ -1924,7 +1957,8 @@ parse_event(Eo_Lexer *ls)
    ev->base.name = eina_stringshare_add(eina_strbuf_string_get(buf));
    eo_lexer_dtor_pop(ls);
    Eina_Bool has_scope = EINA_FALSE, has_beta = EINA_FALSE,
-             has_hot   = EINA_FALSE, has_restart = EINA_FALSE;
+             has_hot   = EINA_FALSE, has_restart = EINA_FALSE,
+             has_notify = EINA_FALSE, has_deferred = EINA_FALSE;
    for (;;) switch (ls->t.kw)
      {
       case KW_at_private:
@@ -1950,6 +1984,15 @@ parse_event(Eo_Lexer *ls)
         ev->is_restart = EINA_TRUE;
         eo_lexer_get(ls);
         break;
+      case KW_at_deferred:
+        CASE_LOCK(ls, deferred, "deferred qualifier");
+        ev->is_deferred = EINA_TRUE;
+        eo_lexer_get(ls);
+        break;
+      case KW_at_notify:
+        CASE_LOCK(ls, notify, "notify qualifier");
+        parse_event_notify(ls, ev);
+        break;
       default:
         goto end;
      }
diff --git a/src/lib/eolian/eolian_database.h b/src/lib/eolian/eolian_database.h
index 63b283d20a..4a98f9843d 100644
--- a/src/lib/eolian/eolian_database.h
+++ b/src/lib/eolian/eolian_database.h
@@ -347,9 +347,12 @@ struct _Eolian_Event
    Eolian_Documentation *doc;
    Eolian_Type *type;
    Eolian_Class *klass;
+   Eina_List *notify_names; /* Eina_Stringshare, as written in @notify(...) */
+   Eina_List *notified; /* Eolian_Function, resolved by validation */
    Eolian_Object_Scope scope;
    Eina_Bool is_hot  :1;
    Eina_Bool is_restart :1;
+   Eina_Bool is_deferred :1;
    Eina_Bool nullable :1;
 };
 
diff --git a/src/scripts/pyolian/eolian.py b/src/scripts/pyolian/eolian.py
index b4d2370ad2..c0dfaf4561 100644
--- a/src/scripts/pyolian/eolian.py
+++ b/src/scripts/pyolian/eolian.py
@@ -927,6 +927,14 @@ class Event(Object):
     def is_restart(self):
         return bool(lib.eolian_event_is_restart(self))
 
+    @cached_property
+    def notified_properties(self):
+        return list(Iterator(Function, lib.eolian_event_notified_properties_get(self)))
+
+    @cached_property
+    def is_deferred(self):
+        return bool(lib.eolian_event_notify_is_deferred(self))
+
 
 class Function(Object):
     def __repr__(self):
diff --git a/src/scripts/pyolian/eolian_lib.py b/src/scripts/pyolian/eolian_lib.py
index 8dba57cbab..3ad29903e8 100644
--- a/src/scripts/pyolian/eolian_lib.py
+++ b/src/scripts/pyolian/eolian_lib.py
@@ -535,6 +535,14 @@ lib.eolian_event_is_hot.restype = c_bool
 lib.eolian_event_is_restart.argtypes = (c_void_p,)
 lib.eolian_event_is_restart.restype = c_bool
 
+# EAPI Eina_Iterator *eolian_event_notified_properties_get(const Eolian_Event *event);
+lib.eolian_event_notified_properties_get.argtypes = (c_void_p,)
+lib.eolian_event_notified_properties_get.restype = c_void_p
+
+# EAPI Eina_Bool eolian_event_notify_is_deferred(const Eolian_Event *event);
+lib.eolian_event_notify_is_deferred.argtypes = (c_void_p,)
+lib.eolian_event_notify_is_deferred.restype = c_bool
+
 
 #  Eolian_Part  ###############################################################
 
diff --git a/src/scripts/pyolian/test_eolian.py b/src/scripts/pyolian/test_eolian.py
index 62e1cc8538..7db08b98bd 100755
--- a/src/scripts/pyolian/test_eolian.py
+++ b/src/scripts/pyolian/test_eolian.py
@@ -493,6 +493,27 @@ class TestEolianEvent(object):
         assert ev.class_.name == cls.name
 
 
+class TestEolianEventNotify(object):
+    def test_notify(self):
+        db = eolian.Eolian_State()
+        assert db.directory_add(os.path.join(root_path, 'src', 'tests',
+                                             'eolian', 'data'))
+        assert db.file_parse('notify.eo')
+        cls = db.class_by_name_get('Notify')
+        names = lambda ev: [(f.name, f.class_.name)
+                            for f in ev.notified_properties]
+        assert names(cls.event_by_name_get('changed')) == [('value', 'Notify')]
+        assert names(cls.event_by_name_get('both')) == [('value', 'Notify'),
+                                                        ('other', 'Notify')]
+        assert names(cls.event_by_name_get('qualified')) == [
+            ('inherited_prop', 'Notify_Base')]
+        assert cls.event_by_name_get('plain').notified_properties == []
+        assert cls.event_by_name_get('both').is_deferred is True
+        assert cls.event_by_name_get('changed').is_deferred is False
+        assert cls.event_by_name_get('plain').is_deferred is False
+        del db
+
+
 class TestEolianPart(object):
     def test_part(self, eolian_db):
         cls = eolian_db.class_by_name_get('Efl.Ui.Popup')
diff --git a/src/tests/eolian/data/notify.eo b/src/tests/eolian/data/notify.eo
new file mode 100644
index 0000000000..e2398d3183
--- /dev/null
+++ b/src/tests/eolian/data/notify.eo
@@ -0,0 +1,30 @@
+import notify_base;
+
+class Notify extends Notify_Base {
+   [[Docs for class Notify. @since 1.66]]
+   methods {
+      @property value {
+         [[Docs for value. @since 1.66]]
+         get {}
+         set {}
+         values {
+            v: int;
+         }
+      }
+      @property other {
+         [[Docs for other. @since 1.66]]
+         get {}
+         values {
+            v: int;
+         }
+      }
+   }
+   events {
+      changed @notify(value): void;
+      both @notify(value, other) @deferred: void;
+      qualified @notify(Notify_Base.inherited_prop): void;
+      inherited @notify(inherited_prop): void;
+      reversed @deferred @hot @notify(other) @restart: void;
+      plain: void;
+   }
+}
diff --git a/src/tests/eolian/data/notify_bad_class.eo b/src/tests/eolian/data/notify_bad_class.eo
new file mode 100644
index 0000000000..cd33f091f3
--- /dev/null
+++ b/src/tests/eolian/data/notify_bad_class.eo
@@ -0,0 +1,27 @@
+class Notify_Bad_Class {
+   [[Docs for Notify_Bad_Class. @since 1.66]]
+   methods {
+      @property value {
+         [[Docs. @since 1.66]]
+         get {}
+         set {}
+         values { v: int; }
+      }
+      @property set_only {
+         [[Docs. @since 1.66]]
+         set {}
+         values { v: int; }
+      }
+      @property beta_prop @beta {
+         [[Docs. @since 1.66]]
+         get {}
+         values { v: int; }
+      }
+      do_it {
+         [[Docs. @since 1.66]]
+      }
+   }
+   events {
+      bad @notify(Nope.value): void;
+   }
+}
diff --git a/src/tests/eolian/data/notify_base.eo b/src/tests/eolian/data/notify_base.eo
new file mode 100644
index 0000000000..c075bd4500
--- /dev/null
+++ b/src/tests/eolian/data/notify_base.eo
@@ -0,0 +1,12 @@
+abstract Notify_Base {
+   [[Docs for abstract class Notify_Base. @since 1.66]]
+   methods {
+      @property inherited_prop {
+         [[Docs for inherited_prop. @since 1.66]]
+         get {}
+         values {
+            v: int;
+         }
+      }
+   }
+}
diff --git a/src/tests/eolian/data/notify_beta.eo b/src/tests/eolian/data/notify_beta.eo
new file mode 100644
index 0000000000..aafa6754fd
--- /dev/null
+++ b/src/tests/eolian/data/notify_beta.eo
@@ -0,0 +1,27 @@
+class Notify_Beta {
+   [[Docs for Notify_Beta. @since 1.66]]
+   methods {
+      @property value {
+         [[Docs. @since 1.66]]
+         get {}
+         set {}
+         values { v: int; }
+      }
+      @property set_only {
+         [[Docs. @since 1.66]]
+         set {}
+         values { v: int; }
+      }
+      @property beta_prop @beta {
+         [[Docs. @since 1.66]]
+         get {}
+         values { v: int; }
+      }
+      do_it {
+         [[Docs. @since 1.66]]
+      }
+   }
+   events {
+      bad @notify(beta_prop): void;
+   }
+}
diff --git a/src/tests/eolian/data/notify_double.eo b/src/tests/eolian/data/notify_double.eo
new file mode 100644
index 0000000000..066bb4f433
--- /dev/null
+++ b/src/tests/eolian/data/notify_double.eo
@@ -0,0 +1,27 @@
+class Notify_Double {
+   [[Docs for Notify_Double. @since 1.66]]
+   methods {
+      @property value {
+         [[Docs. @since 1.66]]
+         get {}
+         set {}
+         values { v: int; }
+      }
+      @property set_only {
+         [[Docs. @since 1.66]]
+         set {}
+         values { v: int; }
+      }
+      @property beta_prop @beta {
+         [[Docs. @since 1.66]]
+         get {}
+         values { v: int; }
+      }
+      do_it {
+         [[Docs. @since 1.66]]
+      }
+   }
+   events {
+      bad @notify(value) @notify(value): void;
+   }
+}
diff --git a/src/tests/eolian/data/notify_double_deferred.eo b/src/tests/eolian/data/notify_double_deferred.eo
new file mode 100644
index 0000000000..a373254dc2
--- /dev/null
+++ b/src/tests/eolian/data/notify_double_deferred.eo
@@ -0,0 +1,27 @@
+class Notify_Double_Deferred {
+   [[Docs for Notify_Double_Deferred. @since 1.66]]
+   methods {
+      @property value {
+         [[Docs. @since 1.66]]
+         get {}
+         set {}
+         values { v: int; }
+      }
+      @property set_only {
+         [[Docs. @since 1.66]]
+         set {}
+         values { v: int; }
+      }
+      @property beta_prop @beta {
+         [[Docs. @since 1.66]]
+         get {}
+         values { v: int; }
+      }
+      do_it {
+         [[Docs. @since 1.66]]
+      }
+   }
+   events {
+      bad @notify(value) @deferred @deferred: void;
+   }
+}
diff --git a/src/tests/eolian/data/notify_dup.eo b/src/tests/eolian/data/notify_dup.eo
new file mode 100644
index 0000000000..1903689a44
--- /dev/null
+++ b/src/tests/eolian/data/notify_dup.eo
@@ -0,0 +1,27 @@
+class Notify_Dup {
+   [[Docs for Notify_Dup. @since 1.66]]
+   methods {
+      @property value {
+         [[Docs. @since 1.66]]
+         get {}
+         set {}
+         values { v: int; }
+      }
+      @property set_only {
+         [[Docs. @since 1.66]]
+         set {}
+         values { v: int; }
+      }
+      @property beta_prop @beta {
+         [[Docs. @since 1.66]]
+         get {}
+         values { v: int; }
+      }
+      do_it {
+         [[Docs. @since 1.66]]
+      }
+   }
+   events {
+      bad @notify(value, value): void;
+   }
+}
diff --git a/src/tests/eolian/data/notify_empty.eo b/src/tests/eolian/data/notify_empty.eo
new file mode 100644
index 0000000000..7f18dc9642
--- /dev/null
+++ b/src/tests/eolian/data/notify_empty.eo
@@ -0,0 +1,27 @@
+class Notify_Empty {
+   [[Docs for Notify_Empty. @since 1.66]]
+   methods {
+      @property value {
+         [[Docs. @since 1.66]]
+         get {}
+         set {}
+         values { v: int; }
+      }
+      @property set_only {
+         [[Docs. @since 1.66]]
+         set {}
+         values { v: int; }
+      }
+      @property beta_prop @beta {
+         [[Docs. @since 1.66]]
+         get {}
+         values { v: int; }
+      }
+      do_it {
+         [[Docs. @since 1.66]]
+      }
+   }
+   events {
+      bad @notify(): void;
+   }
+}
diff --git a/src/tests/eolian/data/notify_method.eo b/src/tests/eolian/data/notify_method.eo
new file mode 100644
index 0000000000..cb9d82233b
--- /dev/null
+++ b/src/tests/eolian/data/notify_method.eo
@@ -0,0 +1,27 @@
+class Notify_Method {
+   [[Docs for Notify_Method. @since 1.66]]
+   methods {
+      @property value {
+         [[Docs. @since 1.66]]
+         get {}
+         set {}
+         values { v: int; }
+      }
+      @property set_only {
+         [[Docs. @since 1.66]]
+         set {}
+         values { v: int; }
+      }
+      @property beta_prop @beta {
+         [[Docs. @since 1.66]]
+         get {}
+         values { v: int; }
+      }
+      do_it {
+         [[Docs. @since 1.66]]
+      }
+   }
+   events {
+      bad @notify(do_it): void;
+   }
+}
diff --git a/src/tests/eolian/data/notify_no_getter.eo b/src/tests/eolian/data/notify_no_getter.eo
new file mode 100644
index 0000000000..90f63d2750
--- /dev/null
+++ b/src/tests/eolian/data/notify_no_getter.eo
@@ -0,0 +1,27 @@
+class Notify_No_Getter {
+   [[Docs for Notify_No_Getter. @since 1.66]]
+   methods {
+      @property value {
+         [[Docs. @since 1.66]]
+         get {}
+         set {}
+         values { v: int; }
+      }
+      @property set_only {
+         [[Docs. @since 1.66]]
+         set {}
+         values { v: int; }
+      }
+      @property beta_prop @beta {
+         [[Docs. @since 1.66]]
+         get {}
+         values { v: int; }
+      }
+      do_it {
+         [[Docs. @since 1.66]]
+      }
+   }
+   events {
+      bad @notify(set_only): void;
+   }
+}
diff --git a/src/tests/eolian/data/notify_ok_beta.eo b/src/tests/eolian/data/notify_ok_beta.eo
new file mode 100644
index 0000000000..ba467c4212
--- /dev/null
+++ b/src/tests/eolian/data/notify_ok_beta.eo
@@ -0,0 +1,27 @@
+class Notify_Ok_Beta {
+   [[Docs for Notify_Ok_Beta. @since 1.66]]
+   methods {
+      @property value {
+         [[Docs. @since 1.66]]
+         get {}
+         set {}
+         values { v: int; }
+      }
+      @property set_only {
+         [[Docs. @since 1.66]]
+         set {}
+         values { v: int; }
+      }
+      @property beta_prop @beta {
+         [[Docs. @since 1.66]]
+         get {}
+         values { v: int; }
+      }
+      do_it {
+         [[Docs. @since 1.66]]
+      }
+   }
+   events {
+      good @beta @notify(beta_prop): void;
+   }
+}
diff --git a/src/tests/eolian/data/notify_unknown.eo b/src/tests/eolian/data/notify_unknown.eo
new file mode 100644
index 0000000000..d0c9f324a6
--- /dev/null
+++ b/src/tests/eolian/data/notify_unknown.eo
@@ -0,0 +1,27 @@
+class Notify_Unknown {
+   [[Docs for Notify_Unknown. @since 1.66]]
+   methods {
+      @property value {
+         [[Docs. @since 1.66]]
+         get {}
+         set {}
+         values { v: int; }
+      }
+      @property set_only {
+         [[Docs. @since 1.66]]
+         set {}
+         values { v: int; }
+      }
+      @property beta_prop @beta {
+         [[Docs. @since 1.66]]
+         get {}
+         values { v: int; }
+      }
+      do_it {
+         [[Docs. @since 1.66]]
+      }
+   }
+   events {
+      bad @notify(nothing_here): void;
+   }
+}
diff --git a/src/tests/eolian/eolian_parsing.c b/src/tests/eolian/eolian_parsing.c
index 12d5ce4e59..dd620868e6 100644
--- a/src/tests/eolian/eolian_parsing.c
+++ b/src/tests/eolian/eolian_parsing.c
@@ -1693,6 +1693,122 @@ EFL_START_TEST(eolian_construct_only_invalid)
 }
 EFL_END_TEST
 
+EFL_START_TEST(eolian_event_notify)
+{
+   static const struct { const char *file, *msg; } bad[] = {
+      { "notify_no_getter.eo", "has no getter" },
+      { "notify_method.eo", "is a method" },
+      { "notify_unknown.eo", "no property 'nothing_here'" },
+      { "notify_beta.eo", "is beta" },
+      { "notify_dup.eo", "twice" },
+      { "notify_double.eo", "double notify qualifier" },
+      { "notify_double_deferred.eo", "double deferred qualifier" },
+      { "notify_empty.eo", "" },
+      { "notify_bad_class.eo", "no property 'Nope.value'" },
+   };
+   const Eolian_Class *class;
+   const Eolian_Event *ev;
+   const Eolian_Function *fn;
+   const Eolian_Unit *unit;
+   Eina_Iterator *iter, *props;
+   unsigned int i;
+
+   Eolian_State *eos = eolian_state_new();
+   fail_if(!eolian_state_directory_add(eos, TESTS_SRC_DIR"/data"));
+   fail_if(!(unit = eolian_state_file_parse(eos, "notify.eo")));
+   fail_if(!(class = eolian_unit_class_by_name_get(unit, "Notify")));
+   fail_if(!(iter = eolian_class_events_get(class)));
+
+   /* changed @notify(value) */
+   fail_if(!eina_iterator_next(iter, (void**)&ev));
+   fail_if(strcmp(eolian_event_name_get(ev), "changed"));
+   fail_if(!(props = eolian_event_notified_properties_get(ev)));
+   fail_if(!eina_iterator_next(props, (void**)&fn));
+   fail_if(strcmp(eolian_function_name_get(fn), "value"));
+   fail_if(eolian_function_type_get(fn) != EOLIAN_PROPERTY);
+   fail_if(eina_iterator_next(props, (void**)&fn));
+   eina_iterator_free(props);
+   fail_if(eolian_event_notify_is_deferred(ev));
+
+   /* both @notify(value, other) @deferred */
+   fail_if(!eina_iterator_next(iter, (void**)&ev));
+   fail_if(strcmp(eolian_event_name_get(ev), "both"));
+   fail_if(!(props = eolian_event_notified_properties_get(ev)));
+   fail_if(!eina_iterator_next(props, (void**)&fn));
+   fail_if(strcmp(eolian_function_name_get(fn), "value"));
+   fail_if(!eina_iterator_next(props, (void**)&fn));
+   fail_if(strcmp(eolian_function_name_get(fn), "other"));
+   fail_if(eina_iterator_next(props, (void**)&fn));
+   eina_iterator_free(props);
+   fail_if(!eolian_event_notify_is_deferred(ev));
+
+   /* qualified @notify(Notify_Base.inherited_prop) */
+   fail_if(!eina_iterator_next(iter, (void**)&ev));
+   fail_if(strcmp(eolian_event_name_get(ev), "qualified"));
+   fail_if(!(props = eolian_event_notified_properties_get(ev)));
+   fail_if(!eina_iterator_next(props, (void**)&fn));
+   fail_if(strcmp(eolian_function_name_get(fn), "inherited_prop"));
+   fail_if(strcmp(eolian_class_name_get(eolian_function_class_get(fn)), "Notify_Base"));
+   fail_if(eina_iterator_next(props, (void**)&fn));
+   eina_iterator_free(props);
+   fail_if(eolian_event_notify_is_deferred(ev));
+
+   /* inherited @notify(inherited_prop), found by the unqualified name */
+   fail_if(!eina_iterator_next(iter, (void**)&ev));
+   fail_if(strcmp(eolian_event_name_get(ev), "inherited"));
+   fail_if(!(props = eolian_event_notified_properties_get(ev)));
+   fail_if(!eina_iterator_next(props, (void**)&fn));
+   fail_if(strcmp(eolian_class_name_get(eolian_function_class_get(fn)), "Notify_Base"));
+   eina_iterator_free(props);
+
+   /* qualifiers in any order, mixed with the older ones */
+   fail_if(!eina_iterator_next(iter, (void**)&ev));
+   fail_if(strcmp(eolian_event_name_get(ev), "reversed"));
+   fail_if(!eolian_event_is_hot(ev));
+   fail_if(!eolian_event_is_restart(ev));
+   fail_if(!eolian_event_notify_is_deferred(ev));
+   fail_if(!(props = eolian_event_notified_properties_get(ev)));
+   fail_if(!eina_iterator_next(props, (void**)&fn));
+   fail_if(strcmp(eolian_function_name_get(fn), "other"));
+   eina_iterator_free(props);
+
+   /* plain: nothing notified, not deferred */
+   fail_if(!eina_iterator_next(iter, (void**)&ev));
+   fail_if(strcmp(eolian_event_name_get(ev), "plain"));
+   if ((props = eolian_event_notified_properties_get(ev)))
+     {
+        fail_if(eina_iterator_next(props, (void**)&fn));
+        eina_iterator_free(props);
+     }
+   fail_if(eolian_event_notify_is_deferred(ev));
+   fail_if(eina_iterator_next(iter, (void**)&ev));
+   eina_iterator_free(iter);
+   eolian_state_free(eos);
+
+   /* a beta event may name a beta property */
+   eos = eolian_state_new();
+   fail_if(!eolian_state_directory_add(eos, TESTS_SRC_DIR"/data"));
+   fail_if(!eolian_state_file_parse(eos, "notify_ok_beta.eo"));
+   eolian_state_free(eos);
+
+   /* each invalid file is refused for the reason in its message */
+   for (i = 0; i < EINA_C_ARRAY_LENGTH(bad); i++)
+     {
+        Eina_Strbuf *sb = eina_strbuf_new();
+
+        eos = eolian_state_new();
+        eolian_state_error_cb_set(eos, _construct_only_error_cb);
+        eolian_state_error_data_set(eos, sb);
+        fail_if(!eolian_state_directory_add(eos, TESTS_SRC_DIR"/data"));
+        fail_if(eolian_state_file_parse(eos, bad[i].file));
+        ck_assert_msg(!!strstr(eina_strbuf_string_get(sb), bad[i].msg),
+                      "%s: unexpected error '%s'", bad[i].file, eina_strbuf_string_get(sb));
+        eolian_state_free(eos);
+        eina_strbuf_free(sb);
+     }
+}
+EFL_END_TEST
+
 EFL_START_TEST(eolian_mixins_require)
 {
    const Eolian_Unit *unit;
@@ -1935,6 +2051,7 @@ void eolian_parsing_test(TCase *tc)
    tcase_add_test(tc, eolian_consts);
    tcase_add_test(tc, eolian_override);
    tcase_add_test(tc, eolian_events);
+   tcase_add_test(tc, eolian_event_notify);
    tcase_add_test(tc, eolian_namespaces);
    tcase_add_test(tc, eolian_struct);
    tcase_add_test(tc, eolian_extern);

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to