mirror of
https://github.com/mappu/miqt.git
synced 2024-12-23 01:18:37 +00:00
genbindings: rename more go reserved words
This commit is contained in:
parent
189a93fbca
commit
5381a6b80c
@ -306,7 +306,7 @@ func parseMethod(node map[string]interface{}, mm *CppMethod) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Block reserved Go words, replace with generic parameters
|
// Block reserved Go words, replace with generic parameters
|
||||||
if parmName == "default" || parmName == "const" || parmName == "func" {
|
if goReservedWord(parmName) {
|
||||||
parmName += "Val"
|
parmName += "Val"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,6 +7,15 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func goReservedWord(s string) bool {
|
||||||
|
switch s {
|
||||||
|
case "default", "const", "func", "var", "type", "len", "new", "copy", "import":
|
||||||
|
return true
|
||||||
|
default:
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (p CppParameter) RenderTypeGo() string {
|
func (p CppParameter) RenderTypeGo() string {
|
||||||
if p.Pointer && p.ParameterType == "char" {
|
if p.Pointer && p.ParameterType == "char" {
|
||||||
return "string"
|
return "string"
|
||||||
|
Loading…
Reference in New Issue
Block a user