test name nodes

This commit is contained in:
z7zmey
2018-01-12 09:14:11 +02:00
parent 7332ab1700
commit 54ecfa2caf
3 changed files with 143 additions and 8 deletions

View File

@@ -6,14 +6,36 @@ import (
// FullyQualified node
type FullyQualified struct {
Name
Parts []node.Node
}
// NewFullyQualified node constuctor
func NewFullyQualified(Parts []node.Node) *FullyQualified {
return &FullyQualified{
Name{
Parts,
},
Parts,
}
}
// Attributes returns node attributes as map
func (n *FullyQualified) Attributes() map[string]interface{} {
return nil
}
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *FullyQualified) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return
}
if n.Parts != nil {
vv := v.GetChildrenVisitor("Parts")
for _, nn := range n.Parts {
if nn != nil {
nn.Walk(vv)
}
}
}
v.LeaveNode(n)
}

View File

@@ -6,14 +6,36 @@ import (
// Relative node
type Relative struct {
Name
Parts []node.Node
}
// NewRelative node constuctor
func NewRelative(Parts []node.Node) *Relative {
return &Relative{
Name{
Parts,
},
Parts,
}
}
// Attributes returns node attributes as map
func (n *Relative) Attributes() map[string]interface{} {
return nil
}
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *Relative) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return
}
if n.Parts != nil {
vv := v.GetChildrenVisitor("Parts")
for _, nn := range n.Parts {
if nn != nil {
nn.Walk(vv)
}
}
}
v.LeaveNode(n)
}