Use match_ast

This commit is contained in:
Aleksey Kladov 2020-03-18 20:51:47 +01:00
parent b28d411866
commit 0bf903411c
2 changed files with 15 additions and 12 deletions

View file

@ -179,10 +179,10 @@ macro_rules! match_ast {
(match $node:ident { $($tt:tt)* }) => { match_ast!(match ($node) { $($tt)* }) };
(match ($node:expr) {
$( ast::$ast:ident($it:ident) => $res:block, )*
$( ast::$ast:ident($it:ident) => $res:expr, )*
_ => $catch_all:expr $(,)?
}) => {{
$( if let Some($it) = ast::$ast::cast($node.clone()) $res else )*
$( if let Some($it) = ast::$ast::cast($node.clone()) { $res } else )*
{ $catch_all }
}};
}