test name nodes
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user