Force passing Source when creating a SourceAnalyzer

This commit is contained in:
Aleksey Kladov 2019-11-16 00:56:51 +03:00
parent 1c819fc8f6
commit d898ecb8f2
10 changed files with 51 additions and 53 deletions

View file

@ -176,9 +176,11 @@ impl SourceFile {
/// ```
#[macro_export]
macro_rules! match_ast {
(match $node:ident {
(match $node:ident { $($tt:tt)* }) => { match_ast!(match ($node) { $($tt)* }) };
(match ($node:expr) {
$( ast::$ast:ident($it:ident) => $res:block, )*
_ => $catch_all:expr,
_ => $catch_all:expr $(,)?
}) => {{
$( if let Some($it) = ast::$ast::cast($node.clone()) $res else )*
{ $catch_all }