From 96166e56855935163995b2b72a8f34c4f93fea22 Mon Sep 17 00:00:00 2001 From: heiazu <13560201846@163.com> Date: Wed, 13 Mar 2024 20:42:52 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=94=AF=E6=8C=81=E7=AE=AD=E5=A4=B4?= =?UTF-8?q?=E5=87=BD=E6=95=B0=E7=9A=84=E8=A7=A3=E6=9E=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/visitor.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/visitor.rs b/src/visitor.rs index b5c68e5..c6b3f46 100644 --- a/src/visitor.rs +++ b/src/visitor.rs @@ -488,6 +488,9 @@ impl ModuleMutVisitor { fn enable_nesting_for_function (&self, body: &mut Box) { body.visit_mut_children_with(&mut &mut self.get_nesting_visitor()); } + fn enable_nesting_for_arrow_function (&self, body: &mut Box) { + body.visit_mut_children_with(&mut &mut self.get_nesting_visitor()); + } } impl VisitMut for ModuleMutVisitor { @@ -614,10 +617,12 @@ impl VisitMut for ModuleMutVisitor { Some(init) => { match &mut **init { Expr::Fn(FnExpr { function, .. }) => { + // const Index = function () {} self.enable_nesting_for_function(function); }, Expr::Arrow(ArrowExpr { body, .. }) => { - // Todo: support arrow funciton + // const Index = () => {} + self.enable_nesting_for_arrow_function(body); }, _ => () }