We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1d3781c commit fae3eceCopy full SHA for fae3ece
crates/swc_ecma_transformer/src/es2019/optional_catch_binding.rs
@@ -1,4 +1,6 @@
1
+use swc_ecma_ast::*;
2
use swc_ecma_hooks::VisitMutHook;
3
+use swc_ecma_utils::private_ident;
4
5
use crate::TraverseCtx;
6
@@ -8,4 +10,12 @@ pub fn hook() -> impl VisitMutHook<TraverseCtx> {
8
10
9
11
struct OptionalCatchBindingPass {}
12
-impl VisitMutHook<TraverseCtx> for OptionalCatchBindingPass {}
13
+impl VisitMutHook<TraverseCtx> for OptionalCatchBindingPass {
14
+ fn enter_catch_clause(&mut self, node: &mut CatchClause, _: &mut TraverseCtx) {
15
+ if node.param.is_none() {
16
+ // TODO: Do not use private_ident! here.
17
+ // All private identifiers should be tracked using TraverseCtx.
18
+ node.param = Some(Pat::Ident(private_ident!("unused")));
19
+ }
20
21
+}
0 commit comments