diff options
Diffstat (limited to 'pkgtools/pkglint/files/mkshwalker.go')
-rw-r--r-- | pkgtools/pkglint/files/mkshwalker.go | 30 |
1 files changed, 0 insertions, 30 deletions
diff --git a/pkgtools/pkglint/files/mkshwalker.go b/pkgtools/pkglint/files/mkshwalker.go index eb96104ff70..0cb6f513906 100644 --- a/pkgtools/pkglint/files/mkshwalker.go +++ b/pkgtools/pkglint/files/mkshwalker.go @@ -1,10 +1,5 @@ package pkglint -import ( - "reflect" - "strings" -) - type MkShWalker struct { Callback struct { List func(list *MkShList) @@ -62,31 +57,6 @@ func NewMkShWalker() *MkShWalker { return &MkShWalker{} } -// Path returns a representation of the path in the AST that is -// currently visited. -// -// It is used for debugging only. -// -// See Test_MkShWalker_Walk, Callback.SimpleCommand for examples. -func (w *MkShWalker) Path() string { - var path []string - for _, level := range w.Context { - elementType := reflect.TypeOf(level.Element) - typeName := elementType.Elem().Name() - if typeName == "" { - typeName = "[]" + elementType.Elem().Elem().Name() - } - abbreviated := strings.TrimPrefix(typeName, "MkSh") - if level.Index == -1 { - // TODO: This form should also be used if index == 0 and len == 1. - path = append(path, abbreviated) - } else { - path = append(path, sprintf("%s[%d]", abbreviated, level.Index)) - } - } - return strings.Join(path, ".") -} - // Walk calls the given callback for each node of the parsed shell program, // in visiting order from large to small. func (w *MkShWalker) Walk(list *MkShList) { |