summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/diag.rs4
-rw-r--r--src/eval/ops.rs2
-rw-r--r--src/syntax/visit.rs20
3 files changed, 13 insertions, 13 deletions
diff --git a/src/diag.rs b/src/diag.rs
index 154de24b..90f640f6 100644
--- a/src/diag.rs
+++ b/src/diag.rs
@@ -7,11 +7,11 @@ use crate::syntax::{Span, Spanned};
/// Early-return with a vec-boxed [`Error`].
macro_rules! bail {
($span:expr, $message:expr $(,)?) => {
- return Err($crate::diag::Error::boxed($span, $message,));
+ return Err($crate::diag::Error::boxed($span, $message,))
};
($span:expr, $fmt:expr, $($arg:expr),+ $(,)?) => {
- bail!($span, format!($fmt, $($arg),+));
+ bail!($span, format!($fmt, $($arg),+))
};
}
diff --git a/src/eval/ops.rs b/src/eval/ops.rs
index 5bc61021..6d34b877 100644
--- a/src/eval/ops.rs
+++ b/src/eval/ops.rs
@@ -7,7 +7,7 @@ use Value::*;
/// Bail with a type mismatch error.
macro_rules! mismatch {
($fmt:expr, $($value:expr),* $(,)?) => {
- return Err(format!($fmt, $($value.type_name()),*));
+ return Err(format!($fmt, $($value.type_name()),*))
};
}
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