Fix objective-c method calls.

This commit is contained in:
Greg 2019-04-11 12:00:10 -04:00
parent 74f4073d35
commit 9e3c7c2ce8

View File

@ -141,9 +141,9 @@ func (m Method) isVoid() bool {
return typeOrType2(m.Type,m.Type2) == "void" return typeOrType2(m.Type,m.Type2) == "void"
} }
func (m Method) isObject() bool { // FIXME func (w Wrapper) isObject(m Method) bool { // FIXME NEEDED?
tp := typeOrType2(m.Type,m.Type2) tp,_ := goType(typeOrType2(m.Type,m.Type2),m.Class)
if len(tp) > 1 && tp[0:2] == "NS" { if _,ok := w.Interfaces[tp]; ok {
return true return true
} }
return false return false
@ -481,15 +481,11 @@ func (o *%s) %s(%s) %s%s {
if !y.isVoid() { if !y.isVoid() {
cret = "return " cret = "return "
} }
ccast := ""
if y.isObject() {
cret = "(id)"
}
w.cCode.WriteString(fmt.Sprintf(` w.cCode.WriteString(fmt.Sprintf(`
%s %s
%s_%s(%s) { %s_%s(%s) {
%s[%sobj %s]; %s[(id)obj %s];
}`, cmtype, v.Name, y.Name, y.cparamlist(), cret, ccast, y.objcparamlist())) }`, cmtype, v.Name, y.Name, y.cparamlist(), cret, y.objcparamlist()))
} }
} }
fmt.Println(`package main fmt.Println(`package main