diff options
author | kjeremy <[email protected]> | 2019-10-30 18:38:45 +0000 |
---|---|---|
committer | kjeremy <[email protected]> | 2019-10-30 18:38:45 +0000 |
commit | 7ad55e976c3f88e92075379c8a4c1f413665b458 (patch) | |
tree | ac6407fba56558cab3023fefcda96f50290131ad /crates | |
parent | eee55d4663084a01ce80f5ee201d8e1e345417cd (diff) |
Document match_ast!
Diffstat (limited to 'crates')
-rw-r--r-- | crates/ra_syntax/src/lib.rs | 14 |
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] |
164 | macro_rules! match_ast { | 178 | macro_rules! match_ast { |
165 | (match $node:ident { | 179 | (match $node:ident { |