bind: remove panic for unsupported objects

This commit is contained in:
Sebastien Binet 2015-07-30 16:05:45 +02:00
parent c8787de724
commit 84e83328f8
2 changed files with 20 additions and 0 deletions

View File

@ -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))
}

View File

@ -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))
}