mirror of https://github.com/go-python/gopy.git
bind: remove panic for unsupported objects
This commit is contained in:
parent
c8787de724
commit
84e83328f8
|
@ -7,6 +7,7 @@ package bind
|
|||
import (
|
||||
"fmt"
|
||||
"go/doc"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"golang.org/x/tools/go/types"
|
||||
|
@ -237,11 +238,15 @@ func (p *Package) process() error {
|
|||
|
||||
func (p *Package) addConst(obj *types.Const) {
|
||||
//TODO(sbinet)
|
||||
fmt.Fprintf(os.Stderr, "no yet supported: %v (%T)\n", obj, obj)
|
||||
return
|
||||
panic(fmt.Errorf("not yet supported: %v (%T)", obj, obj))
|
||||
}
|
||||
|
||||
func (p *Package) addVar(obj *types.Var) {
|
||||
//TODO(sbinet)
|
||||
fmt.Fprintf(os.Stderr, "no yet supported: %v (%T)\n", obj, obj)
|
||||
return
|
||||
panic(fmt.Errorf("not yet supported: %v (%T)", obj, obj))
|
||||
}
|
||||
|
||||
|
|
15
bind/vars.go
15
bind/vars.go
|
@ -76,6 +76,21 @@ func getTypedesc(t types.Type) typedesc {
|
|||
case *types.Pointer:
|
||||
elem := typ.Elem()
|
||||
return getTypedesc(elem)
|
||||
|
||||
case *types.Signature:
|
||||
return typedesc{
|
||||
ctype: "GoFunction",
|
||||
cgotype: "GoFunction",
|
||||
pyfmt: "?",
|
||||
}
|
||||
|
||||
case *types.Slice:
|
||||
return typedesc{
|
||||
ctype: "GoSlice",
|
||||
cgotype: "GoSlice",
|
||||
pyfmt: "?",
|
||||
}
|
||||
|
||||
default:
|
||||
panic(fmt.Errorf("unhandled type: %#v\n", typ))
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue