I was just studying closure.go and noticed that we invoke disableExport(sym) for closures created.
The signature for disableExport says
|
// disableExport prevents sym from being included in package export |
|
// data. To be effectual, it must be called before declare. |
However, in the body of disableExport we see that we invoke sym.SetOnExportList(true)
which toggles the symbol to be exported as per
|
func (sym *Sym) SetOnExportList(b bool) { sym.flags.set(symOnExportList, b) } |
This change is from CL 108216
I believe it should be sym.SetOnExportList(false)
The bug only doesn't show because when creating object files we explicitly check that names are exported as per
|
if types.IsExported(n.Sym.Name) || initname(n.Sym.Name) { |
|
exportsym(n) |
|
} |
otherwise if you add debugs you'll see that we encounter closure symbols such as
"".bar.func1
Kindly paging @mdempsky @griesemer
I was just studying closure.go and noticed that we invoke disableExport(sym) for closures created.
The signature for disableExport says
go/src/cmd/compile/internal/gc/dcl.go
Lines 1005 to 1006 in 0ec302c
However, in the body of disableExport we see that we invoke
sym.SetOnExportList(true)which toggles the symbol to be exported as per
go/src/cmd/compile/internal/types/sym.go
Line 55 in 0ec302c
This change is from CL 108216
I believe it should be
sym.SetOnExportList(false)The bug only doesn't show because when creating object files we explicitly check that names are exported as per
go/src/cmd/compile/internal/gc/export.go
Lines 56 to 58 in 0ec302c
otherwise if you add debugs you'll see that we encounter closure symbols such as
"".bar.func1Kindly paging @mdempsky @griesemer