mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-03 16:44:33 +00:00
Expose ability names
This commit is contained in:
parent
95395ffc5f
commit
1beb0551cb
3 changed files with 19 additions and 4 deletions
|
@ -2,9 +2,9 @@ interface Encode
|
||||||
exposes
|
exposes
|
||||||
[
|
[
|
||||||
Encoder,
|
Encoder,
|
||||||
# Encoding,
|
Encoding,
|
||||||
toEncoder,
|
toEncoder,
|
||||||
# EncoderFormatting,
|
EncoderFormatting,
|
||||||
u8, u16, u32, u64, u128,
|
u8, u16, u32, u64, u128,
|
||||||
i8, i16, i32, i64, i128,
|
i8, i16, i32, i64, i128,
|
||||||
f32, f64, dec,
|
f32, f64, dec,
|
||||||
|
|
|
@ -187,6 +187,13 @@ impl AbilitiesStore {
|
||||||
self.ability_members.get(&member)
|
self.ability_members.get(&member)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Iterator over all abilities and their members that this store knows about.
|
||||||
|
pub fn iter_abilities(&self) -> impl Iterator<Item = (Symbol, &[Symbol])> {
|
||||||
|
self.members_of_ability
|
||||||
|
.iter()
|
||||||
|
.map(|(k, v)| (*k, v.as_slice()))
|
||||||
|
}
|
||||||
|
|
||||||
/// Returns an iterator over pairs ((ability member, type), specialization) specifying that
|
/// Returns an iterator over pairs ((ability member, type), specialization) specifying that
|
||||||
/// "ability member" has a "specialization" for type "type".
|
/// "ability member" has a "specialization" for type "type".
|
||||||
pub fn iter_specializations(
|
pub fn iter_specializations(
|
||||||
|
|
|
@ -518,8 +518,16 @@ pub fn canonicalize_module_defs<'a>(
|
||||||
aliases.insert(symbol, alias);
|
aliases.insert(symbol, alias);
|
||||||
}
|
}
|
||||||
|
|
||||||
for member in scope.abilities_store.root_ability_members().keys() {
|
for (ability, members) in scope
|
||||||
|
.abilities_store
|
||||||
|
.iter_abilities()
|
||||||
|
.filter(|(ab, _)| ab.module_id() == home)
|
||||||
|
{
|
||||||
|
exposed_but_not_defined.remove(&ability);
|
||||||
|
members.iter().for_each(|member| {
|
||||||
|
debug_assert!(member.module_id() == home);
|
||||||
exposed_but_not_defined.remove(member);
|
exposed_but_not_defined.remove(member);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// By this point, all exposed symbols should have been removed from
|
// By this point, all exposed symbols should have been removed from
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue