Skip to content

Commit 606fa2d

Browse files
committed
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 <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]>
1 parent 8f3d985 commit 606fa2d

File tree

1 file changed

+3
-18
lines changed

1 file changed

+3
-18
lines changed

src/go/types/decl.go

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -38,22 +38,7 @@ func (check *Checker) declare(scope *Scope, id *ast.Ident, obj Object, pos token
3838
}
3939

4040
// pathString returns a string of the form a->b-> ... ->g for a path [a, b, ... g].
41-
// TODO(gri) remove once we don't need the old cycle detection (explicitly passed
42-
// []*TypeName path) anymore
43-
func pathString(path []*TypeName) string {
44-
var s string
45-
for i, p := range path {
46-
if i > 0 {
47-
s += "->"
48-
}
49-
s += p.Name()
50-
}
51-
return s
52-
}
53-
54-
// objPathString returns a string of the form a->b-> ... ->g for a path [a, b, ... g].
55-
// TODO(gri) s/objPathString/pathString/ once we got rid of pathString above
56-
func objPathString(path []Object) string {
41+
func pathString(path []Object) string {
5742
var s string
5843
for i, p := range path {
5944
if i > 0 {
@@ -68,7 +53,7 @@ func objPathString(path []Object) string {
6853
// For the meaning of def, see Checker.definedType, in typexpr.go.
6954
func (check *Checker) objDecl(obj Object, def *Named) {
7055
if trace {
71-
check.trace(obj.Pos(), "-- checking %s %s (objPath = %s)", obj.color(), obj, objPathString(check.objPath))
56+
check.trace(obj.Pos(), "-- checking %s %s (objPath = %s)", obj.color(), obj, pathString(check.objPath))
7257
check.indent++
7358
defer func() {
7459
check.indent--
@@ -291,7 +276,7 @@ func (check *Checker) typeCycle(obj Object) (isCycle bool) {
291276
}
292277

293278
if trace {
294-
check.trace(obj.Pos(), "## cycle detected: objPath = %s->%s (len = %d)", objPathString(cycle), obj.Name(), ncycle)
279+
check.trace(obj.Pos(), "## cycle detected: objPath = %s->%s (len = %d)", pathString(cycle), obj.Name(), ncycle)
295280
check.trace(obj.Pos(), "## cycle contains: %d values, has indirection = %v, has type definition = %v", nval, hasIndir, hasTDef)
296281
defer func() {
297282
if isCycle {

0 commit comments

Comments
 (0)