@@ -6,9 +6,9 @@ package bind
6
6
7
7
import (
8
8
"fmt"
9
+ "go/types"
9
10
"log"
10
11
"strconv"
11
- "go/types"
12
12
"strings"
13
13
)
14
14
@@ -111,7 +111,7 @@ func (g *pyGen) genFuncSig(sym *symbol, fsym *Func) bool {
111
111
}
112
112
}
113
113
114
- if i != nargs - 1 || ! fsym .isVariadic {
114
+ if i != nargs - 1 || ! fsym .isVariadic {
115
115
wpArgs = append (wpArgs , anm )
116
116
}
117
117
}
@@ -245,13 +245,13 @@ func isIfaceHandle(gdoc string) (bool, string) {
245
245
}
246
246
247
247
func isPointer (pyfmt string ) bool {
248
- if ( pyfmt == "s" ) {
248
+ if pyfmt == "s" {
249
249
return true
250
250
}
251
251
return false
252
252
}
253
253
254
- func (g * pyGen )generateReturn (buildPyTuple bool , npyres int , results []* Var , retvals * []string ) {
254
+ func (g * pyGen ) generateReturn (buildPyTuple bool , npyres int , results []* Var , retvals * []string ) {
255
255
g .gofile .Printf ("\n " )
256
256
valueCalls := make ([]string , npyres , npyres )
257
257
for i := 0 ; i < npyres ; i ++ {
@@ -263,7 +263,7 @@ func (g *pyGen)generateReturn(buildPyTuple bool, npyres int, results []*Var, ret
263
263
result .Name (),
264
264
))
265
265
}
266
- formatStr := sret .pyfmt
266
+ formatStr := sret .pyfmt
267
267
if sret .pyfmt == "" {
268
268
formatStr = "?"
269
269
}
@@ -278,10 +278,10 @@ func (g *pyGen)generateReturn(buildPyTuple bool, npyres int, results []*Var, ret
278
278
}
279
279
280
280
if result .sym .go2py != "" {
281
- retval = result .sym .go2py + "(" + retval + ")" + result .sym .go2pyParenEx
281
+ retval = result .sym .go2py + "(" + retval + ")" + result .sym .go2pyParenEx
282
282
}
283
283
284
- if ( buildPyTuple ) {
284
+ if buildPyTuple {
285
285
buildValueFunc := "C.Py_BuildValue1"
286
286
typeCast := "unsafe.Pointer"
287
287
if ! isPointer (formatStr ) {
@@ -301,7 +301,7 @@ func (g *pyGen)generateReturn(buildPyTuple bool, npyres int, results []*Var, ret
301
301
302
302
if npyres == 0 {
303
303
g .gofile .Printf ("return\n " )
304
- } else if ( buildPyTuple ) {
304
+ } else if buildPyTuple {
305
305
g .gofile .Printf ("retTuple := C.PyTuple_New(%d);\n " , npyres )
306
306
for i := 0 ; i < npyres ; i ++ {
307
307
g .gofile .Printf ("C.PyTuple_SetItem(retTuple, %d, %s);\n " , i , valueCalls [i ])
@@ -389,7 +389,7 @@ if __err != nil {
389
389
default :
390
390
na = anm
391
391
}
392
- if i == len (args ) - 1 && fsym .isVariadic {
392
+ if i == len (args )- 1 && fsym .isVariadic {
393
393
na = na + "..."
394
394
}
395
395
callArgs = append (callArgs , na )
@@ -471,20 +471,20 @@ if __err != nil {
471
471
if isMethod {
472
472
if sym .isStruct () {
473
473
goFuncCall = fmt .Sprintf ("gopyh.Embed(vifc, reflect.TypeOf(%s{})).(%s).%s(%s)" ,
474
- nonPtrName (symNm ),
475
- symNm ,
476
- fsym .GoName (),
477
- strings .Join (callArgs , ", " ))
474
+ nonPtrName (symNm ),
475
+ symNm ,
476
+ fsym .GoName (),
477
+ strings .Join (callArgs , ", " ))
478
478
} else {
479
479
goFuncCall = fmt .Sprintf ("vifc.(%s).%s(%s)" ,
480
- symNm ,
481
- fsym .GoName (),
482
- strings .Join (callArgs , ", " ))
480
+ symNm ,
481
+ fsym .GoName (),
482
+ strings .Join (callArgs , ", " ))
483
483
}
484
484
} else {
485
485
goFuncCall = fmt .Sprintf ("%s(%s)" ,
486
- fsym .GoFmt (),
487
- strings .Join (callArgs , ", " ))
486
+ fsym .GoFmt (),
487
+ strings .Join (callArgs , ", " ))
488
488
}
489
489
490
490
if nres > 0 {
@@ -501,7 +501,7 @@ if __err != nil {
501
501
502
502
// ReMap handle returns from pyFuncCall.
503
503
for i := 0 ; i < npyres ; i ++ {
504
- if res [i ].sym .hasHandle () && ! res [i ].sym .isPtrOrIface (){
504
+ if res [i ].sym .hasHandle () && ! res [i ].sym .isPtrOrIface () {
505
505
retvals [i ] = "&" + retvals [i ]
506
506
}
507
507
}
@@ -532,7 +532,7 @@ if __err != nil {
532
532
}
533
533
}
534
534
535
- g .generateReturn (buildPyTuple (fsym ), npyres , res , & retvals );
535
+ g .generateReturn (buildPyTuple (fsym ), npyres , res , & retvals )
536
536
} else {
537
537
g .gofile .Printf ("if boolPyToGo(goRun) {\n " )
538
538
g .gofile .Indent ()
0 commit comments