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 7cbb2cd71b4d8108ea4f5facfe8fefa67f29b7dd
Author: [email protected] <[email protected]>
AuthorDate: Sun Mar 29 22:06:12 2026 -0600
feat(ego-gen): wire indexed property collection into class processing
Indexed properties are now collected alongside regular properties in
both the own-property and extension-forwarding loops, then passed
to the template via ClassData.IndexedProperties.
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
---
cmd/ego-gen/main.go | 42 ++++++++++++++++++++++++++++++++++--------
1 file changed, 34 insertions(+), 8 deletions(-)
diff --git a/cmd/ego-gen/main.go b/cmd/ego-gen/main.go
index 1cb6c6a..f296bef 100644
--- a/cmd/ego-gen/main.go
+++ b/cmd/ego-gen/main.go
@@ -593,8 +593,10 @@ func buildClassData(c *Class, pkgOptionNames map[string]map[string]bool) (ClassD
reservedNames[parentGoType] = true
}
- // Extract properties, skipping indexed, unsupported, or blocklisted ones.
+ // Extract properties. Non-indexed properties become PropertyData;
+ // indexed properties (those with key params) become IndexedPropertyData.
var properties []PropertyData
+ var indexedProperties []IndexedPropertyData
for _, f := range c.Functions(FunctionProperty) {
// Check the blocklist for both getter and setter C names.
getterName := f.FullCName(FunctionPropGet)
@@ -605,7 +607,17 @@ func buildClassData(c *Class, pkgOptionNames map[string]map[string]bool) (ClassD
}
pd, err := buildPropertyData(f, cPrefix)
if err != nil {
- log.Printf("ego-gen: skip property %s.%s: %v", eolianName, f.Name(), err)
+ // Try as indexed property before giving up.
+ ipd, ipErr := buildIndexedPropertyData(f, cPrefix)
+ if ipErr != nil {
+ log.Printf("ego-gen: skip property %s.%s: %v", eolianName, f.Name(), err)
+ continue
+ }
+ if reservedNames[ipd.GoAccessorMethod] {
+ log.Printf("ego-gen: skip indexed property %s.%s: name %q collides with embedded field", eolianName, f.Name(), ipd.GoAccessorMethod)
+ continue
+ }
+ indexedProperties = append(indexedProperties, ipd)
continue
}
if reservedNames[pd.GoGetter] {
@@ -646,6 +658,9 @@ func buildClassData(c *Class, pkgOptionNames map[string]map[string]bool) (ClassD
goNames[p.GoGetter] = true
goNames[p.GoSetter] = true
}
+ for _, ip := range indexedProperties {
+ goNames[ip.GoAccessorMethod] = true
+ }
for _, m := range methods {
goNames[m.GoName] = true
}
@@ -670,6 +685,16 @@ func buildClassData(c *Class, pkgOptionNames map[string]map[string]bool) (ClassD
}
pd, err := buildPropertyData(f, extCPrefix)
if err != nil {
+ // Try as indexed property.
+ ipd, ipErr := buildIndexedPropertyData(f, extCPrefix)
+ if ipErr != nil {
+ continue
+ }
+ if goNames[ipd.GoAccessorMethod] || reservedNames[ipd.GoAccessorMethod] {
+ continue
+ }
+ goNames[ipd.GoAccessorMethod] = true
+ indexedProperties = append(indexedProperties, ipd)
continue
}
if goNames[pd.GoGetter] || goNames[pd.GoSetter] || reservedNames[pd.GoGetter] {
@@ -878,12 +903,13 @@ func buildClassData(c *Class, pkgOptionNames map[string]map[string]bool) (ClassD
IsMixin: isMixin,
IsInterface: isInterface,
Methods: methods,
- Properties: properties,
- Events: events,
- Interfaces: interfaces,
- ExtraEOHeaders: extraEOHeaders,
- Constructors: constructors,
- PropertyOptions: propertyOptions,
+ Properties: properties,
+ IndexedProperties: indexedProperties,
+ Events: events,
+ Interfaces: interfaces,
+ ExtraEOHeaders: extraEOHeaders,
+ Constructors: constructors,
+ PropertyOptions: propertyOptions,
}, nil
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.