Refactor publicity system

This commit is contained in:
2026-05-13 05:48:59 +02:00
parent e416af3403
commit c1cb9bd7bf
9 changed files with 49 additions and 44 deletions
+9 -5
View File
@@ -791,11 +791,15 @@ impl From<pest::iterators::Pair<'_, Rule>> for FunctionDecl {
impl From<&mut pest::iterators::Pairs<'_, Rule>> for Visibility {
fn from(pairs: &mut pest::iterators::Pairs<'_, Rule>) -> Self {
if listen_rule(pairs, Rule::export) {
Visibility::Public
} else {
Visibility::Private
}
consume_rule(pairs, Rule::visibility)
.map(|pair| {
if let Some(path) = pair.into_inner().next() {
Visibility::PublicTarget(Path::from(path))
} else {
Visibility::Public
}
})
.unwrap_or_else(|| Visibility::Private)
}
}