Skip to content

Commit

Permalink
Use VisitWith
Browse files Browse the repository at this point in the history
  • Loading branch information
smoelius committed Jul 22, 2024
1 parent 4136bba commit 82bc0fe
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions backends/src/ts/mocha/visitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use necessist_core::framework::TestSpanMaps;
use std::cell::RefCell;
use swc_core::ecma::{
ast::{Expr, Module, Stmt},
visit::{visit_expr, visit_stmt, Visit},
visit::{Visit, VisitWith},
};

#[allow(clippy::unnecessary_wraps)]
Expand Down Expand Up @@ -48,7 +48,7 @@ impl<'context, 'config, 'backend, 'ast, 'storage> Visit
let walk = self.generic_visitor.visit_test(self.storage, test);

if walk {
visit_stmt(self, stmt);
stmt.visit_children_with(self);
}

self.generic_visitor.visit_test_post(self.storage, test);
Expand All @@ -66,7 +66,7 @@ impl<'context, 'config, 'backend, 'ast, 'storage> Visit
.visit_statement(self.storage, statement);

if walk {
visit_stmt(self, stmt);
stmt.visit_children_with(self);
}

self.generic_visitor
Expand All @@ -78,7 +78,7 @@ impl<'context, 'config, 'backend, 'ast, 'storage> Visit
let expr = unsafe { std::mem::transmute::<&Expr, &'ast Expr>(expr) };

if is_it_call_expr(expr).is_some() {
visit_expr(self, expr);
expr.visit_children_with(self);

return;
}
Expand All @@ -92,7 +92,7 @@ impl<'context, 'config, 'backend, 'ast, 'storage> Visit
let walk = self.generic_visitor.visit_call(self.storage, call);

if walk {
visit_expr(self, expr);
expr.visit_children_with(self);
} else {
self.visit_callee(&call.node.callee);
}
Expand All @@ -102,6 +102,6 @@ impl<'context, 'config, 'backend, 'ast, 'storage> Visit
return;
}

visit_expr(self, expr);
expr.visit_children_with(self);
}
}

0 comments on commit 82bc0fe

Please # to comment.