From 82bc0fe9260663e60eb0c33af85d3c126059a6f5 Mon Sep 17 00:00:00 2001 From: Samuel Moelius Date: Fri, 19 Jul 2024 17:31:25 +0000 Subject: [PATCH] Use `VisitWith` --- backends/src/ts/mocha/visitor.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/backends/src/ts/mocha/visitor.rs b/backends/src/ts/mocha/visitor.rs index 9e816360..be4a0564 100644 --- a/backends/src/ts/mocha/visitor.rs +++ b/backends/src/ts/mocha/visitor.rs @@ -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)] @@ -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); @@ -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 @@ -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; } @@ -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); } @@ -102,6 +102,6 @@ impl<'context, 'config, 'backend, 'ast, 'storage> Visit return; } - visit_expr(self, expr); + expr.visit_children_with(self); } }