mirror of
https://github.com/mappu/miqt.git
synced 2025-01-03 06:08:38 +00:00
genbindings/cabi: move method renaming to helper function
This commit is contained in:
parent
7880f14c52
commit
d3a159a462
@ -198,6 +198,16 @@ func (m CppMethod) CppCallTarget() string {
|
|||||||
return m.MethodName
|
return m.MethodName
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *CppMethod) Rename(newName string) {
|
||||||
|
if m.OverrideMethodName == "" {
|
||||||
|
m.OverrideMethodName = m.MethodName
|
||||||
|
} else {
|
||||||
|
// If it was already set, we're already a level of overload resolution deep - preserve it
|
||||||
|
}
|
||||||
|
|
||||||
|
m.MethodName = newName
|
||||||
|
}
|
||||||
|
|
||||||
func IsArgcArgv(params []CppParameter, pos int) bool {
|
func IsArgcArgv(params []CppParameter, pos int) bool {
|
||||||
// Check if the arguments starting at position=pos are the argc/argv pattern.
|
// Check if the arguments starting at position=pos are the argc/argv pattern.
|
||||||
// QApplication/QGuiApplication constructors are the only expected example of this.
|
// QApplication/QGuiApplication constructors are the only expected example of this.
|
||||||
|
@ -33,8 +33,7 @@ func astTransformOptional(parsed *CppParsedHeader) {
|
|||||||
// Add method copies
|
// Add method copies
|
||||||
for x := optionalStart; x < len(m.Parameters); x++ {
|
for x := optionalStart; x < len(m.Parameters); x++ {
|
||||||
dupMethod := m // copy
|
dupMethod := m // copy
|
||||||
dupMethod.MethodName = m.MethodName + fmt.Sprintf("%d", x+1)
|
dupMethod.Rename(m.MethodName + fmt.Sprintf("%d", x+1))
|
||||||
dupMethod.OverrideMethodName = m.MethodName
|
|
||||||
dupMethod.Parameters = m.Parameters[0 : x+1]
|
dupMethod.Parameters = m.Parameters[0 : x+1]
|
||||||
dupMethod.HiddenParams = m.Parameters[x+1:]
|
dupMethod.HiddenParams = m.Parameters[x+1:]
|
||||||
|
|
||||||
|
@ -63,12 +63,7 @@ func astTransformOverloads(parsed *CppParsedHeader) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
existing[proposedName] = struct{}{}
|
existing[proposedName] = struct{}{}
|
||||||
if m.OverrideMethodName == "" {
|
m.Rename(proposedName)
|
||||||
m.OverrideMethodName = m.MethodName
|
|
||||||
} else {
|
|
||||||
// If it was already set, we're already a level of overload resolution deep - preserve it
|
|
||||||
}
|
|
||||||
m.MethodName = proposedName
|
|
||||||
c.Methods[j] = m
|
c.Methods[j] = m
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user