Skip to content

Commit 96166e5

Browse files
committed
feat: 支持箭头函数的解析
1 parent 42e66d8 commit 96166e5

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/visitor.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,9 @@ impl ModuleMutVisitor {
488488
fn enable_nesting_for_function (&self, body: &mut Box<Function>) {
489489
body.visit_mut_children_with(&mut &mut self.get_nesting_visitor());
490490
}
491+
fn enable_nesting_for_arrow_function (&self, body: &mut Box<BlockStmtOrExpr>) {
492+
body.visit_mut_children_with(&mut &mut self.get_nesting_visitor());
493+
}
491494
}
492495

493496
impl VisitMut for ModuleMutVisitor {
@@ -614,10 +617,12 @@ impl VisitMut for ModuleMutVisitor {
614617
Some(init) => {
615618
match &mut **init {
616619
Expr::Fn(FnExpr { function, .. }) => {
620+
// const Index = function () {}
617621
self.enable_nesting_for_function(function);
618622
},
619623
Expr::Arrow(ArrowExpr { body, .. }) => {
620-
// Todo: support arrow funciton
624+
// const Index = () => {}
625+
self.enable_nesting_for_arrow_function(body);
621626
},
622627
_ => ()
623628
}

0 commit comments

Comments
 (0)