]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: fix up shape type package
authorKeith Randall <khr@golang.org>
Wed, 3 Nov 2021 18:26:37 +0000 (11:26 -0700)
committerKeith Randall <khr@golang.org>
Wed, 3 Nov 2021 20:30:17 +0000 (20:30 +0000)
Use go.shape instead of .shape as the package the compiler uses
to store shape types.

Prevent path escaping for compiler-internal types, so we don't
need to see %2e everywhere.

Change-Id: I98e39c3b6472560113bdea7e0ba6eb7b81cb35e0
Reviewed-on: https://go-review.googlesource.com/c/go/+/361174
Trust: Keith Randall <khr@golang.org>
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dan Scales <danscales@google.com>
src/cmd/compile/internal/types/pkg.go
src/cmd/compile/internal/types/type.go

index f63a357f0d092921835d7b31896777780a0eabcd..fe42049ceedfbd462c36f9eef4be4a2fdb294304 100644 (file)
@@ -9,6 +9,7 @@ import (
        "cmd/internal/objabi"
        "fmt"
        "sort"
+       "strings"
        "sync"
 )
 
@@ -48,7 +49,13 @@ func NewPkg(path, name string) *Pkg {
        p := new(Pkg)
        p.Path = path
        p.Name = name
-       p.Prefix = objabi.PathToPrefix(path)
+       if strings.HasPrefix(path, "go.") {
+               // Special compiler-internal packages don't need to be escaped.
+               // This particularly helps with the go.shape package.
+               p.Prefix = path
+       } else {
+               p.Prefix = objabi.PathToPrefix(path)
+       }
        p.Syms = make(map[string]*Sym)
        pkgMap[path] = p
 
index c3efbc9f0717789d305774b76dd19918542556f2..6288df30d6ce18d7f90def271ebe5e9edfd9e9b3 100644 (file)
@@ -2202,4 +2202,4 @@ var (
 
 var SimType [NTYPE]Kind
 
-var ShapePkg = NewPkg(".shape", ".shape")
+var ShapePkg = NewPkg("go.shape", "go.shape")