node position
This commit is contained in:
@@ -13,6 +13,7 @@ func NewFullyQualified(parts []node.Node) node.Node {
|
||||
NameNode{
|
||||
"FullyQualifiedName",
|
||||
map[string]interface{}{},
|
||||
nil,
|
||||
parts,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import (
|
||||
type NameNode struct {
|
||||
name string
|
||||
attributes map[string]interface{}
|
||||
position *node.Position
|
||||
parts []node.Node
|
||||
}
|
||||
|
||||
@@ -14,6 +15,7 @@ func NewName(parts []node.Node) node.Node {
|
||||
return NameNode{
|
||||
"Name",
|
||||
map[string]interface{}{},
|
||||
nil,
|
||||
parts,
|
||||
}
|
||||
}
|
||||
@@ -34,6 +36,15 @@ func (n NameNode) SetAttribute(key string, value interface{}) {
|
||||
n.attributes[key] = value
|
||||
}
|
||||
|
||||
func (n NameNode) Position() *node.Position {
|
||||
return n.position
|
||||
}
|
||||
|
||||
func (n NameNode) SetPosition(p *node.Position) node.Node {
|
||||
n.position = p
|
||||
return n
|
||||
}
|
||||
|
||||
func (n NameNode) Walk(v node.Visitor) {
|
||||
if v.EnterNode(n) == false {
|
||||
return
|
||||
|
||||
@@ -7,6 +7,7 @@ import (
|
||||
type NamePart struct {
|
||||
name string
|
||||
attributes map[string]interface{}
|
||||
position *node.Position
|
||||
}
|
||||
|
||||
func NewNamePart(value string) node.Node {
|
||||
@@ -15,6 +16,7 @@ func NewNamePart(value string) node.Node {
|
||||
map[string]interface{}{
|
||||
"value": value,
|
||||
},
|
||||
nil,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,6 +36,15 @@ func (n NamePart) SetAttribute(key string, value interface{}) {
|
||||
n.attributes[key] = value
|
||||
}
|
||||
|
||||
func (n NamePart) Position() *node.Position {
|
||||
return n.position
|
||||
}
|
||||
|
||||
func (n NamePart) SetPosition(p *node.Position) node.Node {
|
||||
n.position = p
|
||||
return n
|
||||
}
|
||||
|
||||
func (n NamePart) Walk(v node.Visitor) {
|
||||
if v.EnterNode(n) == false {
|
||||
return
|
||||
|
||||
@@ -13,6 +13,7 @@ func NewRelative(parts []node.Node) node.Node {
|
||||
NameNode{
|
||||
"RelativeName",
|
||||
map[string]interface{}{},
|
||||
nil,
|
||||
parts,
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user