ast: add comments about implementation rule on Accept method.

This commit is contained in:
Ewan Chou
2015-11-04 17:59:12 +08:00
parent fce519486f
commit b8a7e68631

View File

@ -26,6 +26,11 @@ type Node interface {
// Accept accepts Visitor to visit itself.
// The returned node should replace original node.
// ok returns false to stop visiting.
//
// Implementation of this method should first call visitor.Enter,
// assign the returned node to its method receiver, if skipChildren returns true,
// children should be skipped. Otherwise, call its children in particular order that
// later elements depends on on former elements. Finally, return visitor.Leave.
Accept(v Visitor) (node Node, ok bool)
// Text returns the original text of the element.
Text() string