Update way to identify self in signature

This commit is contained in:
Glyphack
2025-09-04 20:11:16 +02:00
parent f34b6d8245
commit 178f48fc0b
4 changed files with 67 additions and 80 deletions

View File

@@ -3030,6 +3030,12 @@ impl Parameters {
.find(|arg| arg.parameter.name.as_str() == name)
}
/// Returns the index of the parameter with the given name
pub fn index(&self, name: &str) -> Option<usize> {
self.iter_non_variadic_params()
.position(|arg| arg.parameter.name.as_str() == name)
}
/// Returns an iterator over all parameters included in this [`Parameters`] node.
pub fn iter(&self) -> ParametersIterator<'_> {
ParametersIterator::new(self)