1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

vdoc: minor features + fixes

This commit is contained in:
Ned Palacios
2020-06-08 16:28:46 +08:00
committed by GitHub
parent 6c9b2b8303
commit 721a3a24ae
3 changed files with 80 additions and 34 deletions

View File

@@ -178,6 +178,14 @@ pub fn new(input_path string) Doc {
}
}
pub fn (nodes []DocNode) index_by_name(node_name string) ?int {
for i, node in nodes {
if node.name != node_name { continue }
return i
}
return error('Node with the name "$node_name" was not found.')
}
pub fn (nodes []DocNode) find_children_of(parent_type string) []DocNode {
if parent_type.len == 0 {
return []DocNode{}