cmd/compile: simplify exportsym flags and logic
We used to have three Sym flags for dealing with export/reexport: Export, Package, and Exported. Export and Package were used to distinguish whether a symbol is exported or package-scope (i.e., mutually exclusive), except that for local declarations Export served double-duty as tracking whether the symbol had been added to exportlist. Meanwhile, imported declarations that needed reexporting could be added to exportlist multiple times, necessitating a flag to track whether they'd already been written out by exporter. Simplify all of these into a single OnExportList flag so that we can ensure symbols on exportlist are present exactly once. Merge reexportsym into exportsym so there's a single place where we append to exportlist. Code that used to set Exported to prevent a symbol from being exported can now just set OnExportList before calling declare to prevent it from even appearing on exportlist. Lastly, drop the IsAlias check in exportsym: we call exportsym too early for local symbols to detect if they're an alias, and we never reexport aliases. Passes toolstash-check. Change-Id: Icdea3719105dc169fcd7651606589cd08b0a80ff Reviewed-on: https://go-review.googlesource.com/103865 Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Showing
Please
register
or
sign in
to comment