Skip to content

Commit

Permalink
cmd/compile: fix up shape type package
Browse files Browse the repository at this point in the history
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 <[email protected]>
Trust: Dan Scales <[email protected]>
Run-TryBot: Keith Randall <[email protected]>
TryBot-Result: Go Bot <[email protected]>
Reviewed-by: Dan Scales <[email protected]>
  • Loading branch information
randall77 committed Nov 3, 2021
1 parent 74f99d0 commit 7f2463c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion src/cmd/compile/internal/types/pkg.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"cmd/internal/objabi"
"fmt"
"sort"
"strings"
"sync"
)

Expand Down Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion src/cmd/compile/internal/types/type.go
Original file line number Diff line number Diff line change
Expand Up @@ -2202,4 +2202,4 @@ var (

var SimType [NTYPE]Kind

var ShapePkg = NewPkg(".shape", ".shape")
var ShapePkg = NewPkg("go.shape", "go.shape")

0 comments on commit 7f2463c

Please sign in to comment.