Skip to content

Commit 6d7abc4

Browse files
authored
Define numchildren() function (#464)
1 parent a11e664 commit 6d7abc4

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/syntax_tree.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ end
108108

109109
haschildren(node::TreeNode) = node.children !== nothing
110110
children(node::TreeNode) = (c = node.children; return c === nothing ? () : c)
111+
numchildren(node::TreeNode) = (isnothing(node.children) ? 0 : length(node.children))
111112

112113

113114
"""

0 commit comments

Comments
 (0)