]> Cypherpunks repositories - gostls13.git/commitdiff
[dev.unified] cmd/compile: only sort symbols by name and package path
authorCuong Manh Le <cuong.manhle.vn@gmail.com>
Mon, 6 Jun 2022 17:07:26 +0000 (00:07 +0700)
committerGopher Robot <gobot@golang.org>
Mon, 6 Jun 2022 19:19:30 +0000 (19:19 +0000)
Since CL 393715, the path of package being compiled is now always known,
so symbols can be sorted by package path instead of package height.

Updates #51734

Change-Id: Ie543e2fdef4b93f3f0b97c6bcec0a4dcff788f2c
Reviewed-on: https://go-review.googlesource.com/c/go/+/410654
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
src/cmd/compile/internal/types/sym.go

index 927ebc453a616f4e411cf7e233d1f6d3804c7215..9d8707befa594b15080eb77b2969c4e49d572456 100644 (file)
@@ -97,14 +97,7 @@ func (sym *Sym) LinksymABI(abi obj.ABI) *obj.LSym {
 // Less reports whether symbol a is ordered before symbol b.
 //
 // Symbols are ordered exported before non-exported, then by name, and
-// finally (for non-exported symbols) by package height and path.
-//
-// Ordering by package height is necessary to establish a consistent
-// ordering for non-exported names with the same spelling but from
-// different packages. We don't necessarily know the path for the
-// package being compiled, but by definition it will have a height
-// greater than any other packages seen within the compilation unit.
-// For more background, see issue #24693.
+// finally (for non-exported symbols) by package path.
 func (a *Sym) Less(b *Sym) bool {
        if a == b {
                return false
@@ -131,9 +124,6 @@ func (a *Sym) Less(b *Sym) bool {
                return a.Name < b.Name
        }
        if !ea {
-               if a.Pkg.Height != b.Pkg.Height {
-                       return a.Pkg.Height < b.Pkg.Height
-               }
                return a.Pkg.Path < b.Pkg.Path
        }
        return false