llgo/ssa: StringData/StringLen
This commit is contained in:
@@ -140,8 +140,8 @@ type aProgram struct {
|
||||
callNoArgs *types.Signature
|
||||
callOneArg *types.Signature
|
||||
|
||||
needRuntime bool
|
||||
needPyInit bool
|
||||
NeedRuntime bool
|
||||
NeedPyInit bool
|
||||
}
|
||||
|
||||
// A Program presents a program.
|
||||
@@ -189,21 +189,11 @@ func (p Program) SetRuntime(runtime any) {
|
||||
}
|
||||
}
|
||||
|
||||
// NeedRuntime returns if the current package needs runtime.
|
||||
func (p Program) NeedRuntime() bool {
|
||||
return p.needRuntime
|
||||
}
|
||||
|
||||
// NeedPyInit returns if the current package needs Python initialization.
|
||||
func (p Program) NeedPyInit() bool {
|
||||
return p.needPyInit
|
||||
}
|
||||
|
||||
func (p Program) runtime() *types.Package {
|
||||
if p.rt == nil {
|
||||
p.rt = p.rtget()
|
||||
}
|
||||
p.needRuntime = true
|
||||
p.NeedRuntime = true
|
||||
return p.rt
|
||||
}
|
||||
|
||||
@@ -268,7 +258,7 @@ func (p Program) NewPackage(name, pkgPath string) Package {
|
||||
stubs := make(map[string]Function)
|
||||
pyfns := make(map[string]PyFunction)
|
||||
pymods := make(map[string]Global)
|
||||
p.needRuntime = false
|
||||
p.NeedRuntime = false
|
||||
// Don't need reset p.needPyInit here
|
||||
// p.needPyInit = false
|
||||
return &aPackage{mod, gbls, fns, stubs, pyfns, pymods, p}
|
||||
@@ -397,7 +387,7 @@ func (p Package) rtFunc(fnName string) Expr {
|
||||
}
|
||||
|
||||
func (p Package) pyFunc(fullName string, sig *types.Signature) Expr {
|
||||
p.Prog.needPyInit = true
|
||||
p.Prog.NeedPyInit = true
|
||||
return p.NewFunc(fullName, sig, InC).Expr
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user