vkFuncDecl, vkFuncPtr, vkClosure; callback example

This commit is contained in:
xushiwei
2024-05-05 15:59:33 +08:00
parent 03a194a514
commit 067cf0cba6
11 changed files with 136 additions and 38 deletions

View File

@@ -40,7 +40,8 @@ const (
vkString
vkBool
vkPtr
vkFunc
vkFuncDecl
vkFuncPtr
vkClosure
vkTuple
vkDelayExpr = -1
@@ -241,7 +242,7 @@ func (p Program) toType(raw types.Type) Type {
case *types.Named:
return p.toNamed(t)
case *types.Signature: // represents a C function pointer in raw type
return &aType{p.toLLVMFuncPtr(t), typ, vkFunc}
return &aType{p.toLLVMFuncPtr(t), typ, vkFuncPtr}
case *types.Array:
elem := p.rawType(t.Elem())
return &aType{llvm.ArrayType(elem.ll, int(t.Len())), typ, vkInvalid}