@@ -6,12 +6,14 @@ use oxc_traverse::{Traverse, TraverseCtx};
6
6
7
7
use crate :: TransformCtx ;
8
8
9
+ pub mod arrow_function_to_expression;
9
10
pub mod helper_loader;
10
11
pub mod module_imports;
11
12
pub mod statement_injector;
12
13
pub mod top_level_statements;
13
14
pub mod var_declarations;
14
15
16
+ use arrow_function_to_expression:: ArrowFunctionToExpression ;
15
17
use module_imports:: ModuleImports ;
16
18
use statement_injector:: StatementInjector ;
17
19
use top_level_statements:: TopLevelStatements ;
@@ -22,6 +24,7 @@ pub struct Common<'a, 'ctx> {
22
24
var_declarations : VarDeclarations < ' a , ' ctx > ,
23
25
statement_injector : StatementInjector < ' a , ' ctx > ,
24
26
top_level_statements : TopLevelStatements < ' a , ' ctx > ,
27
+ arrow_function_to_expression : ArrowFunctionToExpression < ' a , ' ctx > ,
25
28
}
26
29
27
30
impl < ' a , ' ctx > Common < ' a , ' ctx > {
@@ -31,13 +34,15 @@ impl<'a, 'ctx> Common<'a, 'ctx> {
31
34
var_declarations : VarDeclarations :: new ( ctx) ,
32
35
statement_injector : StatementInjector :: new ( ctx) ,
33
36
top_level_statements : TopLevelStatements :: new ( ctx) ,
37
+ arrow_function_to_expression : ArrowFunctionToExpression :: new ( ctx) ,
34
38
}
35
39
}
36
40
}
37
41
38
42
impl < ' a , ' ctx > Traverse < ' a > for Common < ' a , ' ctx > {
39
43
fn exit_program ( & mut self , program : & mut Program < ' a > , ctx : & mut TraverseCtx < ' a > ) {
40
44
self . module_imports . exit_program ( program, ctx) ;
45
+ self . arrow_function_to_expression . exit_program ( program, ctx) ;
41
46
self . var_declarations . exit_program ( program, ctx) ;
42
47
self . top_level_statements . exit_program ( program, ctx) ;
43
48
}
@@ -58,4 +63,52 @@ impl<'a, 'ctx> Traverse<'a> for Common<'a, 'ctx> {
58
63
self . var_declarations . exit_statements ( stmts, ctx) ;
59
64
self . statement_injector . exit_statements ( stmts, ctx) ;
60
65
}
66
+
67
+ fn enter_function ( & mut self , func : & mut Function < ' a > , ctx : & mut TraverseCtx < ' a > ) {
68
+ self . arrow_function_to_expression . enter_function ( func, ctx) ;
69
+ }
70
+
71
+ fn exit_function ( & mut self , func : & mut Function < ' a > , ctx : & mut TraverseCtx < ' a > ) {
72
+ self . arrow_function_to_expression . exit_function ( func, ctx) ;
73
+ }
74
+
75
+ fn exit_method_definition (
76
+ & mut self ,
77
+ node : & mut MethodDefinition < ' a > ,
78
+ ctx : & mut TraverseCtx < ' a > ,
79
+ ) {
80
+ self . arrow_function_to_expression . exit_method_definition ( node, ctx) ;
81
+ }
82
+
83
+ fn enter_static_block ( & mut self , block : & mut StaticBlock < ' a > , ctx : & mut TraverseCtx < ' a > ) {
84
+ self . arrow_function_to_expression . enter_static_block ( block, ctx) ;
85
+ }
86
+
87
+ fn exit_static_block ( & mut self , block : & mut StaticBlock < ' a > , ctx : & mut TraverseCtx < ' a > ) {
88
+ self . arrow_function_to_expression . exit_static_block ( block, ctx) ;
89
+ }
90
+
91
+ fn enter_jsx_element_name (
92
+ & mut self ,
93
+ element_name : & mut JSXElementName < ' a > ,
94
+ ctx : & mut TraverseCtx < ' a > ,
95
+ ) {
96
+ self . arrow_function_to_expression . enter_jsx_element_name ( element_name, ctx) ;
97
+ }
98
+
99
+ fn enter_jsx_member_expression_object (
100
+ & mut self ,
101
+ object : & mut JSXMemberExpressionObject < ' a > ,
102
+ ctx : & mut TraverseCtx < ' a > ,
103
+ ) {
104
+ self . arrow_function_to_expression . enter_jsx_member_expression_object ( object, ctx) ;
105
+ }
106
+
107
+ fn enter_expression ( & mut self , expr : & mut Expression < ' a > , ctx : & mut TraverseCtx < ' a > ) {
108
+ self . arrow_function_to_expression . enter_expression ( expr, ctx) ;
109
+ }
110
+
111
+ fn exit_expression ( & mut self , expr : & mut Expression < ' a > , ctx : & mut TraverseCtx < ' a > ) {
112
+ self . arrow_function_to_expression . exit_expression ( expr, ctx) ;
113
+ }
61
114
}
0 commit comments