rename Walker to Walkable interface

This commit is contained in:
z7zmey
2018-02-20 19:52:07 +02:00
parent a762ab3754
commit e3ed427fac
11 changed files with 24 additions and 24 deletions

View File

@@ -137,12 +137,12 @@ type visitorMock struct {
visitedKeys []string
}
func (v *visitorMock) EnterNode(n walker.Walker) bool { return v.visitChildren }
func (v *visitorMock) EnterNode(n walker.Walkable) bool { return v.visitChildren }
func (v *visitorMock) GetChildrenVisitor(key string) walker.Visitor {
v.visitedKeys = append(v.visitedKeys, key)
return &visitorMock{v.visitChildren, nil}
}
func (v *visitorMock) LeaveNode(n walker.Walker) {}
func (v *visitorMock) LeaveNode(n walker.Walkable) {}
func TestVisitorDisableChildren(t *testing.T) {
for _, tt := range nodesToTest {

View File

@@ -240,12 +240,12 @@ type visitorMock struct {
visitedKeys []string
}
func (v *visitorMock) EnterNode(n walker.Walker) bool { return v.visitChildren }
func (v *visitorMock) EnterNode(n walker.Walkable) bool { return v.visitChildren }
func (v *visitorMock) GetChildrenVisitor(key string) walker.Visitor {
v.visitedKeys = append(v.visitedKeys, key)
return &visitorMock{v.visitChildren, nil}
}
func (v *visitorMock) LeaveNode(n walker.Walker) {}
func (v *visitorMock) LeaveNode(n walker.Walkable) {}
func TestVisitorDisableChildren(t *testing.T) {
for _, tt := range nodesToTest {

View File

@@ -73,12 +73,12 @@ type visitorMock struct {
visitedKeys []string
}
func (v *visitorMock) EnterNode(n walker.Walker) bool { return v.visitChildren }
func (v *visitorMock) EnterNode(n walker.Walkable) bool { return v.visitChildren }
func (v *visitorMock) GetChildrenVisitor(key string) walker.Visitor {
v.visitedKeys = append(v.visitedKeys, key)
return &visitorMock{v.visitChildren, nil}
}
func (v *visitorMock) LeaveNode(n walker.Walker) {}
func (v *visitorMock) LeaveNode(n walker.Walkable) {}
func TestVisitorDisableChildren(t *testing.T) {
for _, tt := range nodesToTest {

View File

@@ -360,12 +360,12 @@ type visitorMock struct {
visitedKeys []string
}
func (v *visitorMock) EnterNode(n walker.Walker) bool { return v.visitChildren }
func (v *visitorMock) EnterNode(n walker.Walkable) bool { return v.visitChildren }
func (v *visitorMock) GetChildrenVisitor(key string) walker.Visitor {
v.visitedKeys = append(v.visitedKeys, key)
return &visitorMock{v.visitChildren, nil}
}
func (v *visitorMock) LeaveNode(n walker.Walker) {}
func (v *visitorMock) LeaveNode(n walker.Walkable) {}
func TestVisitorDisableChildren(t *testing.T) {
for _, tt := range nodesToTest {

View File

@@ -43,12 +43,12 @@ type visitorMock struct {
visitedKeys []string
}
func (v *visitorMock) EnterNode(n walker.Walker) bool { return v.visitChildren }
func (v *visitorMock) EnterNode(n walker.Walkable) bool { return v.visitChildren }
func (v *visitorMock) GetChildrenVisitor(key string) walker.Visitor {
v.visitedKeys = append(v.visitedKeys, key)
return &visitorMock{v.visitChildren, nil}
}
func (v *visitorMock) LeaveNode(n walker.Walker) {}
func (v *visitorMock) LeaveNode(n walker.Walkable) {}
func TestNameVisitorDisableChildren(t *testing.T) {
for _, tt := range nameNodesTests {

View File

@@ -4,6 +4,6 @@ import "github.com/z7zmey/php-parser/walker"
// Node interface
type Node interface {
walker.Walker
walker.Walkable
Attributes() map[string]interface{} // Attributes returns node attributes as map
}

View File

@@ -52,12 +52,12 @@ type visitorMock struct {
visitedKeys []string
}
func (v *visitorMock) EnterNode(n walker.Walker) bool { return v.visitChildren }
func (v *visitorMock) EnterNode(n walker.Walkable) bool { return v.visitChildren }
func (v *visitorMock) GetChildrenVisitor(key string) walker.Visitor {
v.visitedKeys = append(v.visitedKeys, key)
return &visitorMock{v.visitChildren, nil}
}
func (v *visitorMock) LeaveNode(n walker.Walker) {}
func (v *visitorMock) LeaveNode(n walker.Walkable) {}
func TestNameVisitorDisableChildren(t *testing.T) {
for _, tt := range nameNodesTests {

View File

@@ -486,12 +486,12 @@ type visitorMock struct {
visitedKeys []string
}
func (v *visitorMock) EnterNode(n walker.Walker) bool { return v.visitChildren }
func (v *visitorMock) EnterNode(n walker.Walkable) bool { return v.visitChildren }
func (v *visitorMock) GetChildrenVisitor(key string) walker.Visitor {
v.visitedKeys = append(v.visitedKeys, key)
return &visitorMock{v.visitChildren, nil}
}
func (v *visitorMock) LeaveNode(n walker.Walker) {}
func (v *visitorMock) LeaveNode(n walker.Walkable) {}
func TestVisitorDisableChildren(t *testing.T) {
for _, tt := range nodesToTest {

View File

@@ -51,12 +51,12 @@ type visitorMock struct {
visitedKeys []string
}
func (v *visitorMock) EnterNode(n walker.Walker) bool { return v.visitChildren }
func (v *visitorMock) EnterNode(n walker.Walkable) bool { return v.visitChildren }
func (v *visitorMock) GetChildrenVisitor(key string) walker.Visitor {
v.visitedKeys = append(v.visitedKeys, key)
return &visitorMock{v.visitChildren, nil}
}
func (v *visitorMock) LeaveNode(n walker.Walker) {}
func (v *visitorMock) LeaveNode(n walker.Walkable) {}
func TestNameVisitorDisableChildren(t *testing.T) {
for _, tt := range nodesToTest {