#31 dump to native golang struct
This commit is contained in:
@@ -30,11 +30,12 @@ func (n *Encapsed) Walk(v walker.Visitor) {
|
||||
}
|
||||
|
||||
if n.Parts != nil {
|
||||
vv := v.GetChildrenVisitor("Parts")
|
||||
v.EnterChildList("Parts", n)
|
||||
for _, nn := range n.Parts {
|
||||
if nn != nil {
|
||||
nn.Walk(vv)
|
||||
nn.Walk(v)
|
||||
}
|
||||
}
|
||||
v.LeaveChildList("Parts", n)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,11 +34,12 @@ func (n *Heredoc) Walk(v walker.Visitor) {
|
||||
}
|
||||
|
||||
if n.Parts != nil {
|
||||
vv := v.GetChildrenVisitor("Parts")
|
||||
v.EnterChildList("Parts", n)
|
||||
for _, nn := range n.Parts {
|
||||
if nn != nil {
|
||||
nn.Walk(vv)
|
||||
nn.Walk(v)
|
||||
}
|
||||
}
|
||||
v.LeaveChildList("Parts", n)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,11 +58,15 @@ type visitorMock struct {
|
||||
}
|
||||
|
||||
func (v *visitorMock) EnterNode(n walker.Walkable) bool { return v.visitChildren }
|
||||
func (v *visitorMock) GetChildrenVisitor(key string) walker.Visitor {
|
||||
func (v *visitorMock) LeaveNode(n walker.Walkable) {}
|
||||
func (v *visitorMock) EnterChildNode(key string, w walker.Walkable) {
|
||||
v.visitedKeys = append(v.visitedKeys, key)
|
||||
return &visitorMock{v.visitChildren, nil}
|
||||
}
|
||||
func (v *visitorMock) LeaveNode(n walker.Walkable) {}
|
||||
func (v *visitorMock) LeaveChildNode(key string, w walker.Walkable) {}
|
||||
func (v *visitorMock) EnterChildList(key string, w walker.Walkable) {
|
||||
v.visitedKeys = append(v.visitedKeys, key)
|
||||
}
|
||||
func (v *visitorMock) LeaveChildList(key string, w walker.Walkable) {}
|
||||
|
||||
func TestNameVisitorDisableChildren(t *testing.T) {
|
||||
for _, tt := range nameNodesTests {
|
||||
|
||||
Reference in New Issue
Block a user