Add IdentIds::exposed_values

This commit is contained in:
Agus Zubiaga 2024-04-23 20:12:54 -03:00
parent 0f89d3558a
commit 5ca1494df1
No known key found for this signature in database
3 changed files with 21 additions and 29 deletions

View file

@ -1,4 +1,4 @@
use crate::ident::{Ident, ModuleName};
use crate::ident::{Ident, Lowercase, ModuleName};
use crate::module_err::{IdentIdNotFoundSnafu, ModuleIdNotFoundSnafu, ModuleResult};
use roc_collections::{SmallStringInterner, VecMap};
use roc_error_macros::internal_error;
@ -773,6 +773,13 @@ impl IdentIds {
pub fn is_empty(&self) -> bool {
self.interner.is_empty()
}
pub fn exposed_values(&self) -> Vec<Lowercase> {
self.ident_strs()
.filter(|(_, ident)| ident.starts_with(|c: char| c.is_lowercase()))
.map(|(_, ident)| Lowercase::from(ident))
.collect()
}
}
#[derive(Debug, Default, Clone)]