full test params passing of exported functions

This commit is contained in:
Li Jie
2025-09-12 10:08:01 +08:00
parent 50d1d2e19a
commit cc65ee18b5
9 changed files with 565 additions and 42 deletions

View File

@@ -1344,7 +1344,7 @@ func (b Builder) PrintEx(ln bool, args ...Expr) (ret Expr) {
// -----------------------------------------------------------------------------
func checkExpr(v Expr, t types.Type, b Builder) Expr {
if st, ok := t.Underlying().(*types.Struct); ok && isClosure(st) {
if st, ok := t.Underlying().(*types.Struct); ok && IsClosure(st) {
if v.kind != vkClosure {
return b.Pkg.closureStub(b, t, v)
}

View File

@@ -411,7 +411,7 @@ func (p Program) toLLVMNamedStruct(name string, raw *types.Struct) llvm.Type {
func (p Program) toLLVMStruct(raw *types.Struct) (ret llvm.Type, kind valueKind) {
fields := p.toLLVMFields(raw)
ret = p.ctx.StructType(fields, false)
if isClosure(raw) {
if IsClosure(raw) {
kind = vkClosure
} else {
kind = vkStruct
@@ -419,7 +419,7 @@ func (p Program) toLLVMStruct(raw *types.Struct) (ret llvm.Type, kind valueKind)
return
}
func isClosure(raw *types.Struct) bool {
func IsClosure(raw *types.Struct) bool {
n := raw.NumFields()
if n == 2 {
f1, f2 := raw.Field(0), raw.Field(1)
@@ -508,7 +508,7 @@ func (p Program) toNamed(raw *types.Named) Type {
case *types.Struct:
name := p.llvmNameOf(raw)
kind := vkStruct
if isClosure(t) {
if IsClosure(t) {
kind = vkClosure
}
return &aType{p.toLLVMNamedStruct(name, t), rawType{raw}, kind}

View File

@@ -92,7 +92,7 @@ func (p goTypes) cvtType(typ types.Type) (raw types.Type, cvt bool) {
return types.NewMap(key, elem), true
}
case *types.Struct:
if isClosure(t) {
if IsClosure(t) {
return typ, false
}
return p.cvtStruct(t)