aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/ra_syntax/src/lib.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/crates/ra_syntax/src/lib.rs b/crates/ra_syntax/src/lib.rs
index c315ba552..5dcb6a95a 100644
--- a/crates/ra_syntax/src/lib.rs
+++ b/crates/ra_syntax/src/lib.rs
@@ -160,6 +160,20 @@ impl SourceFile {
160 } 160 }
161} 161}
162 162
163/// Matches a `SyntaxNode` against an `ast` type.
164///
165/// # Example:
166///
167/// ```ignore
168/// match_ast! {
169/// match node {
170/// ast::CallExpr(it) => { ... },
171/// ast::MethodCallExpr(it) => { ... },
172/// ast::MacroCall(it) => { ... },
173/// _ => None,
174/// }
175/// }
176/// ```
163#[macro_export] 177#[macro_export]
164macro_rules! match_ast { 178macro_rules! match_ast {
165 (match $node:ident { 179 (match $node:ident {