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 293b517e5f3939c833526271b893cf84f683161c
Author: [email protected] <[email protected]>
AuthorDate: Mon Mar 30 15:28:47 2026 -0600
feat(ego-gen): wire iterator method detection into class processing
Iterator-returning methods are now detected in both the own-method
and extension-forwarding loops, then passed to the template via
ClassData.IteratorMethods.
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
---
cmd/ego-gen/main.go | 35 ++++++++++++++++++++++++++++++++++-
1 file changed, 34 insertions(+), 1 deletion(-)
diff --git a/cmd/ego-gen/main.go b/cmd/ego-gen/main.go
index 3560665..80bb7ce 100644
--- a/cmd/ego-gen/main.go
+++ b/cmd/ego-gen/main.go
@@ -659,14 +659,29 @@ func buildClassData(c *Class, pkgOptionNames map[string]map[string]bool) (ClassD
properties = append(properties, pd)
}
- // Extract methods, skipping those in the method blocklist.
+ // Extract methods and iterator methods, skipping those in the method blocklist.
var methods []MethodData
+ var iteratorMethods []IteratorMethodData
for _, f := range c.Functions(FunctionMethod) {
cFuncName := f.FullCName(FunctionMethod)
if methodBlocklist[cFuncName] {
log.Printf("ego-gen: skip blocked method %s", cFuncName)
continue
}
+ // Check if this method returns an iterator.
+ if isIteratorReturnType(f) {
+ imd, err := buildIteratorMethodData(f)
+ if err != nil {
+ log.Printf("ego-gen: skip iterator method %s: %v", cFuncName, err)
+ continue
+ }
+ if reservedNames[imd.GoName] {
+ log.Printf("ego-gen: skip iterator method %s: name %q collides", cFuncName, imd.GoName)
+ continue
+ }
+ iteratorMethods = append(iteratorMethods, imd)
+ continue
+ }
md := buildMethodData(f, cPrefix)
if reservedNames[md.GoName] {
log.Printf("ego-gen: skip method %s: name %q collides with embedded field", cFuncName, md.GoName)
@@ -696,6 +711,9 @@ func buildClassData(c *Class, pkgOptionNames map[string]map[string]bool) (ClassD
for _, m := range methods {
goNames[m.GoName] = true
}
+ for _, im := range iteratorMethods {
+ goNames[im.GoName] = true
+ }
for _, e := range events {
goNames[e.GoName] = true
}
@@ -746,6 +764,19 @@ func buildClassData(c *Class, pkgOptionNames map[string]map[string]bool) (ClassD
if methodBlocklist[cFuncName] {
continue
}
+ // Check for iterator methods from extensions.
+ if isIteratorReturnType(f) {
+ imd, err := buildIteratorMethodData(f)
+ if err != nil {
+ continue
+ }
+ if goNames[imd.GoName] || reservedNames[imd.GoName] {
+ continue
+ }
+ goNames[imd.GoName] = true
+ iteratorMethods = append(iteratorMethods, imd)
+ continue
+ }
md := buildMethodData(f, extCPrefix)
if goNames[md.GoName] || reservedNames[md.GoName] {
continue
@@ -946,6 +977,8 @@ func buildClassData(c *Class, pkgOptionNames map[string]map[string]bool) (ClassD
ExtraEOHeaders: extraEOHeaders,
Constructors: constructors,
PropertyOptions: propertyOptions,
+ IteratorMethods: iteratorMethods,
+ HasIterators: len(iteratorMethods) > 0,
}, nil
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.