File tree Expand file tree Collapse file tree 2 files changed +10
-0
lines changed
Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -57,6 +57,8 @@ function inferName(path: NodePath<t.Identifier>): string {
5757 const init = path . parentPath . get ( 'init' ) ;
5858 const suffix = ( init . isExpression ( ) && generateExpressionName ( init ) ) || '' ;
5959 return generateUid ( path . scope , 'v' + titleCase ( suffix ) ) ;
60+ } else if ( path . parentPath . isCatchClause ( ) ) {
61+ return generateUid ( path . scope , 'e' ) ;
6062 } else if ( path . parentPath . isArrayPattern ( ) ) {
6163 return generateUid ( path . scope , 'v' ) ;
6264 } else {
Original file line number Diff line number Diff line change @@ -89,3 +89,11 @@ test('parameters', () => {
8989 ` ) . toMatchInlineSnapshot ( `(p, p2, p3) => p + p2 + p3;` ) ;
9090 expectJS ( '(x = 1) => x;' ) . toMatchInlineSnapshot ( `(p = 1) => p;` ) ;
9191} ) ;
92+
93+ test ( 'try-catch' , ( ) => {
94+ expectJS ( `
95+ try {} catch (x) {}
96+ ` ) . toMatchInlineSnapshot ( `
97+ try {} catch (e) {}
98+ ` ) ;
99+ } ) ;
You can’t perform that action at this time.
0 commit comments