summaryrefslogtreecommitdiff
path: root/src/syntax
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2021-08-14 23:53:57 +0200
committerLaurenz <laurmaedje@gmail.com>2021-08-14 23:53:57 +0200
commit7e6e7e928c5208cc26b62774e3fbc8dda82f10b6 (patch)
treeb571e368e0701751f187ffac941db3a18d9524e9 /src/syntax
parent6ae6d86b9c6fefe6c5379ac1b20ea90634c09c81 (diff)
Adjust macros to new version
Diffstat (limited to 'src/syntax')
-rw-r--r--src/syntax/visit.rs20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/syntax/visit.rs b/src/syntax/visit.rs
index 0a18271d..5e00e1e6 100644
--- a/src/syntax/visit.rs
+++ b/src/syntax/visit.rs
@@ -11,10 +11,9 @@ macro_rules! impl_visitors {
}
impl_visitor! {
- /// Walk syntax trees immutably.
Visit,
- /// Immutable visitor functions.
immutable,
+ immutably,
[$(($name($($tts)*) $body))*]
}
@@ -24,10 +23,9 @@ macro_rules! impl_visitors {
}
impl_visitor! {
- /// Walk syntax trees mutably.
VisitMut,
- /// Mutable visitor functions.
mutable,
+ mutably,
[$(($name($($tts)*) $body mut))*] mut
}
};
@@ -36,8 +34,9 @@ macro_rules! impl_visitors {
/// Implement an immutable or mutable visitor.
macro_rules! impl_visitor {
(
- #[doc = $visit_doc:expr] $visit:ident,
- #[doc = $module_doc:expr] $module:ident,
+ $visit:ident,
+ $mutability:ident,
+ $adjective:ident,
[$((
$name:ident($v:ident, $node:ident: $ty:ty)
$body:block
@@ -45,7 +44,7 @@ macro_rules! impl_visitor {
))*]
$($mut:tt)?
) => {
- #[doc = $visit_doc]
+ #[doc = concat!("Visit syntax trees ", stringify!($adjective), ".")]
pub trait $visit<'ast> {
/// Visit a definition of a binding.
///
@@ -60,14 +59,15 @@ macro_rules! impl_visitor {
fn visit_exit(&mut self) {}
$(fn $name(&mut self, $node: &'ast $($fmut)? $ty) {
- $module::$name(self, $node);
+ $mutability::$name(self, $node);
})*
}
- #[doc = $module_doc]
- pub mod $module {
+ #[doc = concat!("Visitor functions that are ", stringify!($mutability), ".")]
+ pub mod $mutability {
use super::*;
$(
+ #[doc = concat!("Visit a node of type [`", stringify!($ty), "`].")]
pub fn $name<'ast, V>($v: &mut V, $node: &'ast $($fmut)? $ty)
where
V: $visit<'ast> + ?Sized