Skip to content

Commit

Permalink
codegen: remove IsEnum function
Browse files Browse the repository at this point in the history
  • Loading branch information
gucio321 committed Nov 14, 2024
1 parent 6389ec8 commit 06da78f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
5 changes: 0 additions & 5 deletions cmd/codegen/gengo.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,6 @@ func IsStructName(name CIdentifier, ctx *Context) bool {
return ok
}

func IsEnum(name CIdentifier, enums map[CIdentifier]bool) bool {
_, ok := enums[name]
return ok
}

func IsTemplateTypedef(s string) bool {
return strings.Contains(s, "<")
}
4 changes: 3 additions & 1 deletion cmd/codegen/gengo_typedefs.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ func GenerateTypedefs(
continue
}

if IsEnum(k, ctx.enumNames) /*|| IsStructName(k, structs)*/ {
_, isEnum := ctx.enumNames[k]
_, isRefEnum := ctx.refEnumNames[k]
if isEnum || isRefEnum {
if ctx.flags.showGenerated {
glg.Infof("typedef %s has extended deffinition in structs_and_enums.json. Will generate later", k)
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/codegen/return_wrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func getReturnWrapper(
_, isRefEnum := context.refEnumNames[pureType]
_, shouldSkipRefTypedef := context.preset.SkipTypedefs[pureType]
_, isStruct := context.typedefsNames[pureType]
isStruct = isStruct || ((isRefStruct || (isRefTypedef && !IsEnum(pureType, context.refEnumNames))) && !shouldSkipRefTypedef)
isStruct = isStruct || ((isRefStruct || (isRefTypedef && !isRefEnum)) && !shouldSkipRefTypedef)
w, known := returnWrapperMap[t]
// check if is array (match regex)
isArray, err := regexp.Match(".*\\[\\d+\\]", []byte(t))
Expand Down

0 comments on commit 06da78f

Please sign in to comment.