Permalink
Browse files

parser: Adds SetChildren([]Node) method to NodeCollection.

  • Loading branch information...
1 parent 0651721 commit 55c413c9875c62ff7575bbd6b7575f59c03c3c0a @jteeuwen committed Nov 12, 2012
Showing with 6 additions and 4 deletions.
  1. +6 −4 parser/node.go
View
@@ -20,6 +20,7 @@ type NodeCollection interface {
Children() []Node
ChildCount() int
AddChild(v Node)
+ SetChildren([]Node)
Clear()
}
@@ -60,7 +61,8 @@ func newNodeList(file, line, col int) *nodeList {
return n
}
-func (n *nodeList) Clear() { n.children = n.children[:0] }
-func (n *nodeList) Children() []Node { return n.children }
-func (n *nodeList) ChildCount() int { return len(n.children) }
-func (n *nodeList) AddChild(v Node) { n.children = append(n.children, v) }
+func (n *nodeList) Clear() { n.children = n.children[:0] }
+func (n *nodeList) Children() []Node { return n.children }
+func (n *nodeList) ChildCount() int { return len(n.children) }
+func (n *nodeList) AddChild(v Node) { n.children = append(n.children, v) }
+func (n *nodeList) SetChildren(v []Node) { n.children = v }

0 comments on commit 55c413c

Please sign in to comment.