Skip to content

Commit 53b7492

Browse files
authored
Generate QLDoc for getChild
1 parent 6cf7a12 commit 53b7492

2 files changed

Lines changed: 70 additions & 5 deletions

File tree

generator/src/ql_gen.rs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -450,12 +450,21 @@ fn create_field_getters<'a>(
450450
(get_value, Some(get_value_any_index))
451451
}
452452
};
453+
let qldoc = match &field.name {
454+
Some(name) => {
455+
format!("Gets the node corresponding to the field `{}`.", name)
456+
}
457+
None => {
458+
if formal_parameters.len() == 0 {
459+
"Gets the child of this node.".to_owned()
460+
} else {
461+
"Gets the `i`th child of this node.".to_owned()
462+
}
463+
}
464+
};
453465
(
454466
ql::Predicate {
455-
qldoc: field
456-
.name
457-
.as_ref()
458-
.map(|name| format!("Gets the node corresponding to the field `{}`.", name)),
467+
qldoc: Some(qldoc),
459468
name: &field.getter_name,
460469
overridden: false,
461470
return_type,

0 commit comments

Comments
 (0)