compileGlobal: skip pyVar

This commit is contained in:
xushiwei
2024-05-15 16:51:44 +08:00
parent c2e5a78076
commit ee3f55dd41
2 changed files with 13 additions and 6 deletions

View File

@@ -185,7 +185,7 @@ func (p *context) compileMethods(pkg llssa.Package, typ types.Type) {
func (p *context) compileGlobal(pkg llssa.Package, gbl *ssa.Global) {
typ := gbl.Type()
name, vtype := p.varName(gbl.Pkg.Pkg, gbl)
if ignoreName(name) || checkCgo(gbl.Name()) {
if vtype == pyVar || ignoreName(name) || checkCgo(gbl.Name()) {
return
}
if debugInstr {
@@ -831,8 +831,7 @@ func (p *context) compileValue(b llssa.Builder, v ssa.Value) llssa.Expr {
}
return pyFn.Expr
case *ssa.Global:
g := p.varOf(v)
return g.Expr
return p.varOf(v)
case *ssa.Const:
t := types.Default(v.Type())
return b.Const(v.Value, p.prog.Type(t, llssa.InGo))