abiBasic fix
This commit is contained in:
@@ -22,10 +22,25 @@ import (
|
||||
"fmt"
|
||||
"go/types"
|
||||
"hash"
|
||||
|
||||
"github.com/goplus/llgo/internal/abi"
|
||||
)
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
func BasicKind(t *types.Basic) abi.Kind {
|
||||
kind := t.Kind()
|
||||
switch kind {
|
||||
case types.String:
|
||||
return abi.String
|
||||
case types.UnsafePointer:
|
||||
return abi.UnsafePointer
|
||||
}
|
||||
return abi.Kind(kind)
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
type Kind int
|
||||
|
||||
const (
|
||||
|
||||
@@ -36,7 +36,8 @@ func (b Builder) abiBasic(t *types.Basic) Expr {
|
||||
g := b.Pkg.NewVarFrom(name, b.Prog.AbiTypePtrPtr())
|
||||
return b.Load(g.Expr)
|
||||
*/
|
||||
return b.InlineCall(b.Pkg.rtFunc("Basic"), b.Prog.Val(int(t.Kind())))
|
||||
kind := int(abi.BasicKind(t))
|
||||
return b.InlineCall(b.Pkg.rtFunc("Basic"), b.Prog.Val(kind))
|
||||
}
|
||||
|
||||
// abiStruct returns the abi type of the specified struct type.
|
||||
|
||||
Reference in New Issue
Block a user