forked from mirrors/jj
revset: extract aliases_map.function_names()
TemplateAliasesMap has a similar function for symbols, and I'm going to extract a common aliases map type.
This commit is contained in:
parent
60c3f623ef
commit
3db1f9fe5d
1 changed files with 6 additions and 5 deletions
|
@ -542,11 +542,7 @@ fn parse_function_expression(
|
||||||
name,
|
name,
|
||||||
itertools::chain(
|
itertools::chain(
|
||||||
state.function_map.keys().copied(),
|
state.function_map.keys().copied(),
|
||||||
state
|
state.aliases_map.function_names(),
|
||||||
.aliases_map
|
|
||||||
.function_aliases
|
|
||||||
.keys()
|
|
||||||
.map(|n| n.as_ref()),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
@ -586,6 +582,11 @@ impl RevsetAliasesMap {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Iterates function names in arbitrary order.
|
||||||
|
pub fn function_names(&self) -> impl Iterator<Item = &str> {
|
||||||
|
self.function_aliases.keys().map(|n| n.as_ref())
|
||||||
|
}
|
||||||
|
|
||||||
pub fn get_symbol(&self, name: &str) -> Option<&str> {
|
pub fn get_symbol(&self, name: &str) -> Option<&str> {
|
||||||
self.symbol_aliases.get(name).map(|defn| defn.as_ref())
|
self.symbol_aliases.get(name).map(|defn| defn.as_ref())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue