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 (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"go/doc"
|
"go/doc"
|
||||||
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"golang.org/x/tools/go/types"
|
"golang.org/x/tools/go/types"
|
||||||
|
@ -237,11 +238,15 @@ func (p *Package) process() error {
|
||||||
|
|
||||||
func (p *Package) addConst(obj *types.Const) {
|
func (p *Package) addConst(obj *types.Const) {
|
||||||
//TODO(sbinet)
|
//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))
|
panic(fmt.Errorf("not yet supported: %v (%T)", obj, obj))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *Package) addVar(obj *types.Var) {
|
func (p *Package) addVar(obj *types.Var) {
|
||||||
//TODO(sbinet)
|
//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))
|
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:
|
case *types.Pointer:
|
||||||
elem := typ.Elem()
|
elem := typ.Elem()
|
||||||
return getTypedesc(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:
|
default:
|
||||||
panic(fmt.Errorf("unhandled type: %#v\n", typ))
|
panic(fmt.Errorf("unhandled type: %#v\n", typ))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue