genbindings/typedefs: refactor extract single method helper

This commit is contained in:
mappu 2024-11-15 14:23:41 +13:00
parent 0ffb24d11a
commit 6ae2235cb4

View File

@ -34,12 +34,7 @@ func applyTypedefs(p CppParameter) CppParameter {
return p return p
} }
// astTransformTypedefs replaces the ParameterType with any known typedef value. func applyTypedefs_Method(m *CppMethod) {
func astTransformTypedefs(parsed *CppParsedHeader) {
for i, c := range parsed.Classes {
for j, m := range c.Methods {
for k, p := range m.Parameters { for k, p := range m.Parameters {
transformed := applyTypedefs(p) transformed := applyTypedefs(p)
@ -56,21 +51,22 @@ func astTransformTypedefs(parsed *CppParsedHeader) {
if LinuxWindowsCompatCheck(m.ReturnType) { if LinuxWindowsCompatCheck(m.ReturnType) {
m.LinuxOnly = true m.LinuxOnly = true
} }
}
// astTransformTypedefs replaces the ParameterType with any known typedef value.
func astTransformTypedefs(parsed *CppParsedHeader) {
for i, c := range parsed.Classes {
for j, m := range c.Methods {
applyTypedefs_Method(&m)
c.Methods[j] = m c.Methods[j] = m
} }
for j, m := range c.Ctors { for j, m := range c.Ctors {
for k, p := range m.Parameters { applyTypedefs_Method(&m)
transformed := applyTypedefs(p)
m.Parameters[k] = transformed
if LinuxWindowsCompatCheck(transformed) {
m.LinuxOnly = true
}
}
c.Ctors[j] = m c.Ctors[j] = m
} }
parsed.Classes[i] = c parsed.Classes[i] = c