Fix type wrapping and procesing so duplicate types do not get

declared.
This commit is contained in:
gmp
2019-04-27 22:24:05 -04:00
parent 977a09e77e
commit 500b457d32
4 changed files with 51 additions and 27 deletions
+16 -11
View File
@@ -299,7 +299,6 @@ func (w *Wrapper) GetParms(n *ast.ObjCMethodDecl,class string) ([]Parameter,bool
return ret, true
}
// new version of ProcessType
func (w *Wrapper) processTypes(tps []*types.Type) {
switch len(tps) {
case 0:
@@ -315,21 +314,27 @@ func (w *Wrapper) processTypes(tps []*types.Type) {
}
func (w *Wrapper) processType(tp *types.Type) {
bt := tp.BaseType()
if w.Processed[bt.GoType()] { return }
w.Processed[bt.GoType()] = true
if bt.IsFunction() {
gt := tp.GoType()
if gt == "" {
return
}
if gt[0] == '*' {
w.processType(tp.PointsTo())
return
}
if w.Processed[gt] { return }
w.Processed[gt] = true
if gt == "Char" {
w.CharHelpers()
}
if tp.IsFunction() {
return
}
w.goTypes.WriteString(tp.GoTypeDecl())
if tp.GoType() == "*Char" {
w.CharHelpers()
}
super := types.Super(bt.GoType())
super := types.Super(gt)
if super != "" {
types.Wrap(super)
pt := types.NewTypeFromString(super + "*","")
w.processType(pt)
w.processType(types.NewTypeFromString(super,""))
}
}