fluent interface for node SetAttribure

This commit is contained in:
vadim
2018-01-02 14:11:08 +02:00
parent 2051e3a23d
commit 31cc11da0c
153 changed files with 392 additions and 240 deletions

View File

@@ -7,7 +7,7 @@ import (
type NameNode struct {
name string
attributes map[string]interface{}
position *node.Position
position *node.Position
parts []node.Node
}
@@ -32,8 +32,9 @@ func (n NameNode) Attribute(key string) interface{} {
return n.attributes[key]
}
func (n NameNode) SetAttribute(key string, value interface{}) {
func (n NameNode) SetAttribute(key string, value interface{}) node.Node {
n.attributes[key] = value
return n
}
func (n NameNode) Position() *node.Position {

View File

@@ -7,7 +7,7 @@ import (
type NamePart struct {
name string
attributes map[string]interface{}
position *node.Position
position *node.Position
}
func NewNamePart(value string) node.Node {
@@ -32,8 +32,9 @@ func (n NamePart) Attribute(key string) interface{} {
return n.attributes[key]
}
func (n NamePart) SetAttribute(key string, value interface{}) {
func (n NamePart) SetAttribute(key string, value interface{}) node.Node {
n.attributes[key] = value
return n
}
func (n NamePart) Position() *node.Position {