mirror of https://github.com/go-python/gopy.git
bind: prepare support for arrays and slices
This commit is contained in:
parent
9394c947a6
commit
7aaec3faa5
|
@ -477,7 +477,8 @@ func (g *cpyGen) genWrite(valName, seqName string, T types.Type) {
|
||||||
}
|
}
|
||||||
case *types.Named:
|
case *types.Named:
|
||||||
switch u := T.Underlying().(type) {
|
switch u := T.Underlying().(type) {
|
||||||
case *types.Interface, *types.Pointer, *types.Struct:
|
case *types.Interface, *types.Pointer, *types.Struct,
|
||||||
|
*types.Array, *types.Slice:
|
||||||
g.impl.Printf("cgopy_seq_buffer_write_int32(%[1]s, %[2]s);\n", seqName, valName)
|
g.impl.Printf("cgopy_seq_buffer_write_int32(%[1]s, %[2]s);\n", seqName, valName)
|
||||||
case *types.Basic:
|
case *types.Basic:
|
||||||
g.genWrite(valName, seqName, u)
|
g.genWrite(valName, seqName, u)
|
||||||
|
@ -524,7 +525,8 @@ func (g *cpyGen) genRead(valName, seqName string, T types.Type) {
|
||||||
}
|
}
|
||||||
case *types.Named:
|
case *types.Named:
|
||||||
switch u := T.Underlying().(type) {
|
switch u := T.Underlying().(type) {
|
||||||
case *types.Interface, *types.Pointer, *types.Struct:
|
case *types.Interface, *types.Pointer, *types.Struct,
|
||||||
|
*types.Array, *types.Slice:
|
||||||
g.impl.Printf("%[2]s = cgopy_seq_buffer_read_int32(%[1]s);\n", seqName, valName)
|
g.impl.Printf("%[2]s = cgopy_seq_buffer_read_int32(%[1]s);\n", seqName, valName)
|
||||||
case *types.Basic:
|
case *types.Basic:
|
||||||
g.genRead(valName, seqName, u)
|
g.genRead(valName, seqName, u)
|
||||||
|
|
Loading…
Reference in New Issue