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 8333699c41bedfdbbb9c7e950ae8ef65658e9240
Author: [email protected] <[email protected]>
AuthorDate: Mon Mar 9 15:17:41 2026 -0600

    feat: add IsBoolType template helper for boolean type detection
    
    Adds a template helper function to identify boolean types (Eina_Bool
    and bool) that need special handling during property marshaling. This
    supports the upcoming property and method code generation that will
    use these type checks in generated templates.
    
    - IsBoolType function in typemap.go checks for Eina_Bool and bool types
    - Comprehensive tests cover both recognized and unrecognized types
    - isBoolType registered in template FuncMap for use in code generation
    
    Co-Authored-By: Claude Opus 4.6 <[email protected]>
---
 cmd/ego-gen/generator.go    |  1 +
 cmd/ego-gen/typemap.go      |  5 +++++
 cmd/ego-gen/typemap_test.go | 17 +++++++++++++++++
 3 files changed, 23 insertions(+)

diff --git a/cmd/ego-gen/generator.go b/cmd/ego-gen/generator.go
index 9a92266..c4604cc 100644
--- a/cmd/ego-gen/generator.go
+++ b/cmd/ego-gen/generator.go
@@ -95,6 +95,7 @@ func NewGenerator(templateDir, outputDir string) (*Generator, error) {
 		"cTypeToGo":             CTypeToGo,
 		"needsStringConversion": NeedsStringConversion,
 		"isPointerType":         IsPointerType,
+		"isBoolType":            IsBoolType,
 		"cTypeToCgo":            CTypeToCgo,
 	}
 
diff --git a/cmd/ego-gen/typemap.go b/cmd/ego-gen/typemap.go
index 7c4948f..94f990b 100644
--- a/cmd/ego-gen/typemap.go
+++ b/cmd/ego-gen/typemap.go
@@ -67,6 +67,11 @@ func NeedsStringConversion(ctype string) bool {
 		strings.Contains(ctype, "Eina_Stringshare")
 }
 
+// IsBoolType reports whether a C type is a boolean that needs Eina_Bool conversion.
+func IsBoolType(ctype string) bool {
+	return ctype == "Eina_Bool" || ctype == "bool"
+}
+
 // IsPointerType reports whether the Go type is "unsafe.Pointer", which
 // indicates the value must be handled as an opaque C pointer.
 func IsPointerType(goType string) bool {
diff --git a/cmd/ego-gen/typemap_test.go b/cmd/ego-gen/typemap_test.go
index 2ea820b..20cabbb 100644
--- a/cmd/ego-gen/typemap_test.go
+++ b/cmd/ego-gen/typemap_test.go
@@ -106,6 +106,23 @@ func TestNeedsStringConversion(t *testing.T) {
 	}
 }
 
+func TestIsBoolType(t *testing.T) {
+	tests := []struct {
+		ctype string
+		want  bool
+	}{
+		{"Eina_Bool", true},
+		{"bool", true},
+		{"int", false},
+		{"const char *", false},
+	}
+	for _, tc := range tests {
+		if got := IsBoolType(tc.ctype); got != tc.want {
+			t.Errorf("IsBoolType(%q) = %v, want %v", tc.ctype, got, tc.want)
+		}
+	}
+}
+
 func TestIsPointerType(t *testing.T) {
 	tests := []struct {
 		name  string

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

Reply via email to