mirror of
https://github.com/swc-project/swc.git
synced 2024-11-25 22:34:04 +03:00
581aafb4df
**Description:** - `Pass`: `FnMut(&mut Program)`. **Breaking Changes:** - `chain!`: Use a tuple instead. You can replace all `chain!(` with `(` with IDE feature and it will work. - `chain!` with 13 or more args: Use nested tuples for items after 13th element. **Related issue:** - Related to https://github.com/swc-project/swc/issues/9601
31 lines
677 B
Rust
31 lines
677 B
Rust
use swc_common::DUMMY_SP;
|
|
use swc_ecma_ast::*;
|
|
use swc_ecma_visit::NodeRef;
|
|
|
|
#[test]
|
|
fn traverse_lookup() {
|
|
let node = Expr::Call(CallExpr {
|
|
span: DUMMY_SP,
|
|
callee: Callee::Expr(
|
|
AwaitExpr {
|
|
span: DUMMY_SP,
|
|
arg: Ident::new_no_ctxt("foo".into(), DUMMY_SP).into(),
|
|
}
|
|
.into(),
|
|
),
|
|
args: Vec::new(),
|
|
..Default::default()
|
|
});
|
|
|
|
let node_ref = NodeRef::from(&node);
|
|
let iter = node_ref.experimental_traverse();
|
|
|
|
let mut has_await = false;
|
|
|
|
for node in iter {
|
|
has_await |= matches!(node, NodeRef::AwaitExpr(..));
|
|
}
|
|
|
|
assert!(has_await);
|
|
}
|