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 5b52ef387805269622e6277c8c0c2e8a3e746518
Author: [email protected] <[email protected]>
AuthorDate: Mon Mar 30 14:10:31 2026 -0600

    feat(ego-gen): widen buildMultiValueData to accept strings, enums, Eo
    
    Add IsEo to MultiValueData and replace isSimpleCgoType gate with
    isMultiValueCompatible in buildMultiValueData. The data model now
    accepts string, enum typedef, and Eo pointer value types.
    
    Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
---
 cmd/ego-gen/generator.go      |  1 +
 cmd/ego-gen/generator_test.go | 64 +++++++++++++++++++++++++++++++++++++++++++
 cmd/ego-gen/main.go           |  8 ++++--
 3 files changed, 70 insertions(+), 3 deletions(-)

diff --git a/cmd/ego-gen/generator.go b/cmd/ego-gen/generator.go
index daea60f..bc86c77 100644
--- a/cmd/ego-gen/generator.go
+++ b/cmd/ego-gen/generator.go
@@ -80,6 +80,7 @@ type MultiValueData struct {
 	LowerGoName string // e.g. "cols", "rows" (lowerCamelCase, used as Go parameter name)
 	GoType      string // e.g. "int"
 	CType       string // e.g. "int"
+	IsEo        bool   // true when the value type is an Eo class pointer
 }
 
 // PropertyData describes an EFL property with optional getter and setter.
diff --git a/cmd/ego-gen/generator_test.go b/cmd/ego-gen/generator_test.go
index 803bde8..c63104b 100644
--- a/cmd/ego-gen/generator_test.go
+++ b/cmd/ego-gen/generator_test.go
@@ -621,3 +621,67 @@ func TestIsMultiValueCompatible(t *testing.T) {
 		})
 	}
 }
+
+func TestGenerateClass_MultiValueMixedTypes(t *testing.T) {
+	g, outDir := newTestGenerator(t)
+
+	data := ClassData{
+		PackageName:   "ui",
+		GoName:        "LayoutBase",
+		EolianName:    "Efl.Ui.Layout_Base",
+		CClassName:    "EFL_UI_LAYOUT_BASE_CLASS",
+		CClassGetFunc: "efl_ui_layout_base_class_get",
+		CPrefix:       "efl_ui_layout_base",
+		EOHeaderFile:  "efl_ui_layout_base.eo.h",
+		IsAbstract:    true,
+		Properties: []PropertyData{
+			{
+				GoGetter:     "Theme",
+				GoSetter:     "SetTheme",
+				CGetName:     "efl_ui_layout_base_theme_get",
+				CSetName:     "efl_ui_layout_base_theme_set",
+				HasGet:       true,
+				HasSet:       true,
+				IsMultiValue: true,
+				MultiGetValues: []MultiValueData{
+					{GoName: "Klass", LowerGoName: "klass", GoType: "string", CType: "const char *"},
+					{GoName: "Group", LowerGoName: "group", GoType: "string", CType: "const char *"},
+					{GoName: "Style", LowerGoName: "style", GoType: "string", CType: "const char *"},
+				},
+				MultiSetValues: []MultiValueData{
+					{GoName: "Klass", LowerGoName: "klass", GoType: "string", CType: "const char *"},
+					{GoName: "Group", LowerGoName: "group", GoType: "string", CType: "const char *"},
+					{GoName: "Style", LowerGoName: "style", GoType: "string", CType: "const char *"},
+				},
+			},
+		},
+	}
+
+	if err := g.GenerateClass(data); err != nil {
+		t.Fatalf("GenerateClass: %v", err)
+	}
+
+	outFile := filepath.Join(outDir, "ui", "layout_base.go")
+	content, err := os.ReadFile(outFile)
+	if err != nil {
+		t.Fatalf("output file not found at %s: %v", outFile, err)
+	}
+
+	src := string(content)
+
+	mustContain := []string{
+		"func (o *LayoutBase) Theme() (klass string, group string, style string)",
+		"var cKlass *C.char",
+		"C.GoString(cKlass)",
+		"efl_ui_layout_base_theme_get",
+		"func (o *LayoutBase) SetTheme(klass string, group string, style string)",
+		"C.CString(klass)",
+		"efl_ui_layout_base_theme_set",
+	}
+
+	for _, want := range mustContain {
+		if !strings.Contains(src, want) {
+			t.Errorf("output missing expected pattern %q\nfile content:\n%s", want, src)
+		}
+	}
+}
diff --git a/cmd/ego-gen/main.go b/cmd/ego-gen/main.go
index 7044ea7..07defa8 100644
--- a/cmd/ego-gen/main.go
+++ b/cmd/ego-gen/main.go
@@ -975,8 +975,9 @@ func isMultiValueCompatible(ctype string) bool {
 }
 
 // buildMultiValueData converts a slice of Eolian property value Parameters into
-// a []MultiValueData. Returns (data, true) when all params are simple cgo types,
-// or (nil, false) if any param has an unsupported type (string, pointer, struct).
+// a []MultiValueData. Returns (data, true) when all params are multi-value
+// compatible types (simple cgo types, strings, enum typedefs, and Eo class
+// pointers), or (nil, false) if any param has an unsupported type.
 // An empty input results in (nil, true) — vacuously valid.
 func buildMultiValueData(params []*Parameter) ([]MultiValueData, bool) {
 	if len(params) == 0 {
@@ -989,7 +990,7 @@ func buildMultiValueData(params []*Parameter) ([]MultiValueData, bool) {
 			return nil, false
 		}
 		ct := pt.CType()
-		if !isSimpleCgoType(ct) {
+		if !isMultiValueCompatible(ct) {
 			return nil, false
 		}
 		result = append(result, MultiValueData{
@@ -997,6 +998,7 @@ func buildMultiValueData(params []*Parameter) ([]MultiValueData, bool) {
 			LowerGoName: snakeToLowerCamel(p.Name()),
 			GoType:      CTypeToGo(ct),
 			CType:       ct,
+			IsEo:        pt.IsClass(),
 		})
 	}
 	return result, true

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

Reply via email to