Node.Text was intended to get a text value from some inline nodes.
A 'text value' of a Text node is clear.
But
- BaseNode had a default implementation of Node.Text
- Lacks of GoDoc description that Node.Text is valid only for
some inline nodes
So, some users are using Node.Text for BlockNodes.
A 'text value' for a BlockNode is not clear.
e.g. : Text value of a ListNode
- It should be contains list markers?
- What do characters concatinate List items with? newlines? spaces?
- If it contains codeblocks, codeblocks should be fenced or indented?
Now we would like to avoid such ambiguous method.
Including the type of a constant improves discoverability because the
constant is listed next to the type in the godocs.
Before:
```
$ go doc -all . WalkStatus
type WalkStatus int
WalkStatus represents a current status of the Walk function.
```
After:
```shell
$ go doc -all . WalkStatus
type WalkStatus int
WalkStatus represents a current status of the Walk function.
const (
// WalkStop indicates no more walking needed.
WalkStop WalkStatus = iota + 1
// WalkSkipChildren indicates that Walk wont walk on children of current
// node.
WalkSkipChildren
// WalkContinue indicates that Walk can continue to walk.
WalkContinue
)
```
This commit the `iota`-based constants in the AST package to follow
this.