Skip to content

Commit 2eaa3a5

Browse files
committed
Add macro_if!
1 parent 1efc265 commit 2eaa3a5

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

compiler/rustc_ast/src/visitors.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,16 @@ use crate::ptr::P;
1515
use crate::token::{self, Token};
1616
use crate::tokenstream::*;
1717

18+
#[allow(unused)]
19+
macro_rules! macro_if {
20+
($_: tt { $($if: tt)* } $(else {$($else: tt)*})?) => {
21+
$($if)*
22+
};
23+
({ $($if: tt)* } $(else {$($else: tt)*})?) => {
24+
$($($else)*)?
25+
};
26+
}
27+
1828
pub mod visit {
1929
//! AST walker. Each overridden visit method has full control over what
2030
//! happens with its node, it can do its own traversal of the node's children,

0 commit comments

Comments
 (0)