Skip to content

Commit

Permalink
astwalk: use typep package instead of lintutil (#60)
Browse files Browse the repository at this point in the history
Remove code duplication.
We already have IsTypeExpr inside typep package.

Signed-off-by: Iskander Sharipov <quasilyte@gmail.com>
  • Loading branch information
quasilyte authored Dec 10, 2018
1 parent d300ef5 commit a3eb352
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 41 deletions.
8 changes: 4 additions & 4 deletions astwalk/type_expr_walker.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"go/token"
"go/types"

"github.com/go-lintpack/lintpack/internal/lintutil"
"github.com/go-toolsmith/astp"
"github.com/go-toolsmith/typep"
)

type typeExprWalker struct {
Expand Down Expand Up @@ -49,7 +49,7 @@ func (w *typeExprWalker) visit(x ast.Expr) bool {
func (w *typeExprWalker) walk(x ast.Node) bool {
switch x := x.(type) {
case *ast.ParenExpr:
if lintutil.IsTypeExpr(w.info, x.X) {
if typep.IsTypeExpr(w.info, x.X) {
return w.visit(x)
}
return true
Expand All @@ -63,7 +63,7 @@ func (w *typeExprWalker) walk(x ast.Node) bool {
// Like with conversions, method expressions are another special.
return w.inspectInner(x.X)
case *ast.StarExpr:
if lintutil.IsTypeExpr(w.info, x.X) {
if typep.IsTypeExpr(w.info, x.X) {
return w.visit(x)
}
return true
Expand Down Expand Up @@ -95,7 +95,7 @@ func (w *typeExprWalker) walk(x ast.Node) bool {

func (w *typeExprWalker) inspectInner(x ast.Expr) bool {
parens, ok := x.(*ast.ParenExpr)
if ok && lintutil.IsTypeExpr(w.info, parens.X) && astp.IsStarExpr(parens.X) {
if ok && typep.IsTypeExpr(w.info, parens.X) && astp.IsStarExpr(parens.X) {
ast.Inspect(parens.X, w.walk)
return false
}
Expand Down
37 changes: 0 additions & 37 deletions internal/lintutil/lintutil.go

This file was deleted.

0 comments on commit a3eb352

Please sign in to comment.