Commit 606fa2db authored by Robert Griesemer's avatar Robert Griesemer

go/types: remove unused pathString and rename objPathString to pathString (cleanup)

This eliminates an old TODO.

Change-Id: I36d666905f43252f5d338b11ef9c1ed8b5f22b1f
Reviewed-on: https://go-review.googlesource.com/c/go/+/195817
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
parent 8f3d9855
...@@ -38,22 +38,7 @@ func (check *Checker) declare(scope *Scope, id *ast.Ident, obj Object, pos token ...@@ -38,22 +38,7 @@ func (check *Checker) declare(scope *Scope, id *ast.Ident, obj Object, pos token
} }
// pathString returns a string of the form a->b-> ... ->g for a path [a, b, ... g]. // pathString returns a string of the form a->b-> ... ->g for a path [a, b, ... g].
// TODO(gri) remove once we don't need the old cycle detection (explicitly passed func pathString(path []Object) string {
// []*TypeName path) anymore
func pathString(path []*TypeName) string {
var s string
for i, p := range path {
if i > 0 {
s += "->"
}
s += p.Name()
}
return s
}
// objPathString returns a string of the form a->b-> ... ->g for a path [a, b, ... g].
// TODO(gri) s/objPathString/pathString/ once we got rid of pathString above
func objPathString(path []Object) string {
var s string var s string
for i, p := range path { for i, p := range path {
if i > 0 { if i > 0 {
...@@ -68,7 +53,7 @@ func objPathString(path []Object) string { ...@@ -68,7 +53,7 @@ func objPathString(path []Object) string {
// For the meaning of def, see Checker.definedType, in typexpr.go. // For the meaning of def, see Checker.definedType, in typexpr.go.
func (check *Checker) objDecl(obj Object, def *Named) { func (check *Checker) objDecl(obj Object, def *Named) {
if trace { if trace {
check.trace(obj.Pos(), "-- checking %s %s (objPath = %s)", obj.color(), obj, objPathString(check.objPath)) check.trace(obj.Pos(), "-- checking %s %s (objPath = %s)", obj.color(), obj, pathString(check.objPath))
check.indent++ check.indent++
defer func() { defer func() {
check.indent-- check.indent--
...@@ -291,7 +276,7 @@ func (check *Checker) typeCycle(obj Object) (isCycle bool) { ...@@ -291,7 +276,7 @@ func (check *Checker) typeCycle(obj Object) (isCycle bool) {
} }
if trace { if trace {
check.trace(obj.Pos(), "## cycle detected: objPath = %s->%s (len = %d)", objPathString(cycle), obj.Name(), ncycle) check.trace(obj.Pos(), "## cycle detected: objPath = %s->%s (len = %d)", pathString(cycle), obj.Name(), ncycle)
check.trace(obj.Pos(), "## cycle contains: %d values, has indirection = %v, has type definition = %v", nval, hasIndir, hasTDef) check.trace(obj.Pos(), "## cycle contains: %d values, has indirection = %v, has type definition = %v", nval, hasIndir, hasTDef)
defer func() { defer func() {
if isCycle { if isCycle {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment