Skip to content

Commit

Permalink
Remove unused field from MkWalker
Browse files Browse the repository at this point in the history
  • Loading branch information
rillig committed Jan 5, 2025
1 parent e3b92fa commit 475987c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
4 changes: 2 additions & 2 deletions v23/mkline.go
Original file line number Diff line number Diff line change
Expand Up @@ -845,12 +845,12 @@ func (mkline *MkLine) VariableNeedsQuoting(mklines *MkLines, expr *MkExpr, varty

// ForEachUsed calls the action for each variable that is used in the line.
func (mkline *MkLine) ForEachUsed(action func(expr *MkExpr, time EctxTime)) {
walker := NewMkWalker(mkline, action)
walker := NewMkWalker(action)
walker.WalkLine(mkline)
}

func (mkline *MkLine) ForEachUsedText(text string, time EctxTime, action func(expr *MkExpr, time EctxTime)) {
walker := NewMkWalker(mkline, action)
walker := NewMkWalker(action)
walker.WalkText(text, time)
}

Expand Down
5 changes: 2 additions & 3 deletions v23/mkwalker.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@ package pkglint
// MkWalker walks through a makefile line or a text snippet from such a line,
// visiting the expressions and their subexpressions.
type MkWalker struct {
Diag Autofixer
Expr func(expr *MkExpr, time EctxTime)
}

func NewMkWalker(diag Autofixer, expr func(expr *MkExpr, time EctxTime)) *MkWalker {
return &MkWalker{diag, expr}
func NewMkWalker(expr func(expr *MkExpr, time EctxTime)) *MkWalker {
return &MkWalker{expr}
}

// WalkLine calls the action for each variable that is used in the line.
Expand Down
12 changes: 6 additions & 6 deletions v23/mkwalker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ func (s *Suite) Test_NewMkWalker(c *check.C) {
mkline.Notef("Expression \"%s\" at \"%s\" time.", expr.String(), time.String())
}

walker := NewMkWalker(mkline, action)
walker := NewMkWalker(action)
walker.WalkLine(mkline)

t.CheckOutputLines(
Expand All @@ -35,7 +35,7 @@ func (s *Suite) Test_MkWalker_WalkLine(c *check.C) {
action := func(expr *MkExpr, time EctxTime) {
mkline.Notef("Expression \"%s\" at \"%s\" time.", expr.String(), time.String())
}
walker := NewMkWalker(mkline, action)
walker := NewMkWalker(action)
walker.WalkLine(mkline)
})

Expand Down Expand Up @@ -63,7 +63,7 @@ func (s *Suite) Test_MkWalker_WalkText(c *check.C) {
action := func(expr *MkExpr, time EctxTime) {
mkline.Notef("Expression \"%s\" at \"%s\" time.", expr.String(), time.String())
}
walker := NewMkWalker(mkline, action)
walker := NewMkWalker(action)
walker.WalkLine(mkline)
})

Expand All @@ -83,7 +83,7 @@ func (s *Suite) Test_MkWalker_walkDirective(c *check.C) {
action := func(expr *MkExpr, time EctxTime) {
mkline.Notef("Expression \"%s\" at \"%s\" time.", expr.String(), time.String())
}
walker := NewMkWalker(mkline, action)
walker := NewMkWalker(action)
walker.walkDirective(mkline)
})

Expand All @@ -102,7 +102,7 @@ func (s *Suite) Test_MkWalker_walkExpr(c *check.C) {
action := func(expr *MkExpr, time EctxTime) {
mkline.Notef("Expression \"%s\" at \"%s\" time.", expr.String(), time.String())
}
walker := NewMkWalker(mkline, action)
walker := NewMkWalker(action)
walker.WalkLine(mkline)
})

Expand All @@ -125,7 +125,7 @@ func (s *Suite) Test_MkWalker_walkModifier(c *check.C) {
action := func(expr *MkExpr, time EctxTime) {
mkline.Notef("Expression \"%s\" at \"%s\" time.", expr.String(), time.String())
}
walker := NewMkWalker(mkline, action)
walker := NewMkWalker(action)
walker.WalkLine(mkline)
})

Expand Down

0 comments on commit 475987c

Please sign in to comment.