This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch main
in repository ego.
View the commit online.
commit 611c7e56b9f26cb6dc4983db88ae1e54982eff28
Author: [email protected] <[email protected]>
AuthorDate: Mon Mar 30 15:17:39 2026 -0600
feat(ego-gen): add Eolian iterator type introspection
Add BuiltinTypeIterator constant, Type.BaseType() to extract the
inner element type of iterator<T>, and Type.IsIterator() helper.
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
---
cmd/ego-gen/eolian.go | 20 ++++++++++++++++++++
cmd/ego-gen/eolian_test.go | 8 ++++++++
2 files changed, 28 insertions(+)
diff --git a/cmd/ego-gen/eolian.go b/cmd/ego-gen/eolian.go
index 8fb5f2b..3aa1e3e 100644
--- a/cmd/ego-gen/eolian.go
+++ b/cmd/ego-gen/eolian.go
@@ -60,6 +60,10 @@ const (
// BuiltinType represents an Eolian built-in type identifier.
type BuiltinType int
+const (
+ BuiltinTypeIterator BuiltinType = C.EOLIAN_TYPE_BUILTIN_ITERATOR
+)
+
// iterCollect drains an Eina_Iterator into a slice using the provided convert
// function. It frees the iterator when done. Returns nil if iter is nil.
func iterCollect[T any](iter *C.Eina_Iterator, convert func(unsafe.Pointer) T) []T {
@@ -310,6 +314,22 @@ func (t *Type) IsClass() bool {
return C.eolian_type_type_get(t.ptr) == C.EOLIAN_TYPE_CLASS
}
+// BaseType returns the base (inner) type for complex types like iterator<T>.
+// For iterator<Efl.Object>, this returns the Type for Efl.Object.
+// Returns nil if the type has no base type.
+func (t *Type) BaseType() *Type {
+ bt := C.eolian_type_base_type_get(t.ptr)
+ if bt == nil {
+ return nil
+ }
+ return &Type{ptr: bt}
+}
+
+// IsIterator reports whether this type is an iterator<T> built-in type.
+func (t *Type) IsIterator() bool {
+ return t.BuiltinType() == BuiltinTypeIterator
+}
+
// Constructor wraps an Eolian_Constructor pointer.
type Constructor struct {
ptr *C.Eolian_Constructor
diff --git a/cmd/ego-gen/eolian_test.go b/cmd/ego-gen/eolian_test.go
index b9ec9ac..a0a1d6d 100644
--- a/cmd/ego-gen/eolian_test.go
+++ b/cmd/ego-gen/eolian_test.go
@@ -174,6 +174,14 @@ func TestFunctionParameters(t *testing.T) {
})
}
+// TestBuiltinTypeIteratorConstant verifies that BuiltinTypeIterator is a
+// non-zero constant, confirming the C enum value was imported correctly.
+func TestBuiltinTypeIteratorConstant(t *testing.T) {
+ if BuiltinTypeIterator == 0 {
+ t.Error("BuiltinTypeIterator should be non-zero")
+ }
+}
+
// TestClassTypes verifies that every parsed class has a type value within the
// known valid range (i.e. one of the four ClassType constants).
func TestClassTypes(t *testing.T) {
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.