mirror of
https://github.com/mappu/miqt.git
synced 2024-12-23 01:18:37 +00:00
genbindings: call correct c++ function for optional parameters
This commit is contained in:
parent
f9abbed9c7
commit
6fb50dc267
@ -235,6 +235,11 @@ func emitBindingCpp(src *CppParsedHeader, filename string) (string, error) {
|
|||||||
|
|
||||||
preamble, forwarding := emitParametersCABI2CppForwarding(m.Parameters)
|
preamble, forwarding := emitParametersCABI2CppForwarding(m.Parameters)
|
||||||
|
|
||||||
|
nativeMethodName := m.MethodName
|
||||||
|
if m.OverrideMethodName != "" {
|
||||||
|
nativeMethodName = m.OverrideMethodName
|
||||||
|
}
|
||||||
|
|
||||||
ret.WriteString(fmt.Sprintf(
|
ret.WriteString(fmt.Sprintf(
|
||||||
"%s %s_%s(%s) {\n"+
|
"%s %s_%s(%s) {\n"+
|
||||||
"%s"+
|
"%s"+
|
||||||
@ -244,7 +249,7 @@ func emitBindingCpp(src *CppParsedHeader, filename string) (string, error) {
|
|||||||
"\n",
|
"\n",
|
||||||
emitReturnTypeCabi(m.ReturnType), c.ClassName, m.SafeMethodName(), emitParametersCabi(m, "P"+c.ClassName),
|
emitReturnTypeCabi(m.ReturnType), c.ClassName, m.SafeMethodName(), emitParametersCabi(m, "P"+c.ClassName),
|
||||||
preamble,
|
preamble,
|
||||||
shouldReturn, c.ClassName, m.MethodName, forwarding,
|
shouldReturn, c.ClassName, nativeMethodName, forwarding,
|
||||||
afterCall,
|
afterCall,
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
@ -25,6 +25,7 @@ type CppProperty struct {
|
|||||||
|
|
||||||
type CppMethod struct {
|
type CppMethod struct {
|
||||||
MethodName string
|
MethodName string
|
||||||
|
OverrideMethodName string // Present only if we changed the target
|
||||||
ReturnType CppParameter // Name not used
|
ReturnType CppParameter // Name not used
|
||||||
Parameters []CppParameter
|
Parameters []CppParameter
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,7 @@ func astTransformOptional(parsed *CppParsedHeader) {
|
|||||||
for x := optionalStart; x < len(m.Parameters); x++ {
|
for x := optionalStart; x < len(m.Parameters); x++ {
|
||||||
dupMethod := CppMethod{
|
dupMethod := CppMethod{
|
||||||
MethodName: m.MethodName + fmt.Sprintf("%d", x+1),
|
MethodName: m.MethodName + fmt.Sprintf("%d", x+1),
|
||||||
|
OverrideMethodName: m.MethodName,
|
||||||
ReturnType: m.ReturnType,
|
ReturnType: m.ReturnType,
|
||||||
Parameters: nil,
|
Parameters: nil,
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user