File tree Expand file tree Collapse file tree
src/compiler/transformers Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3173,7 +3173,7 @@ namespace ts {
31733173 function visitCatchClause ( node : CatchClause ) : CatchClause {
31743174 const ancestorFacts = enterSubtree ( HierarchyFacts . BlockScopeExcludes , HierarchyFacts . BlockScopeIncludes ) ;
31753175 let updated : CatchClause ;
3176- if ( isBindingPattern ( node . variableDeclaration . name ) ) {
3176+ if ( node . variableDeclaration && isBindingPattern ( node . variableDeclaration . name ) ) {
31773177 const temp = createTempVariable ( /*recordTempVariable*/ undefined ) ;
31783178 const newVariableDeclaration = createVariableDeclaration ( temp ) ;
31793179 setTextRange ( newVariableDeclaration , node . variableDeclaration ) ;
Original file line number Diff line number Diff line change @@ -101,6 +101,8 @@ namespace ts {
101101 return visitExpressionStatement ( node as ExpressionStatement ) ;
102102 case SyntaxKind . ParenthesizedExpression :
103103 return visitParenthesizedExpression ( node as ParenthesizedExpression , noDestructuringValue ) ;
104+ case SyntaxKind . CatchClause :
105+ return visitCatchClause ( node as CatchClause ) ;
104106 default :
105107 return visitEachChild ( node , visitor , context ) ;
106108 }
@@ -212,6 +214,13 @@ namespace ts {
212214 return visitEachChild ( node , noDestructuringValue ? visitorNoDestructuringValue : visitor , context ) ;
213215 }
214216
217+ function visitCatchClause ( node : CatchClause ) : CatchClause {
218+ if ( ! node . variableDeclaration ) {
219+ return updateCatchClause ( node , createVariableDeclaration ( "_ignoredCatchParameter" ) , node . block ) ;
220+ }
221+ return visitEachChild ( node , visitor , context ) ;
222+ }
223+
215224 /**
216225 * Visits a BinaryExpression that contains a destructuring assignment.
217226 *
You can’t perform that action at this time.
0 commit comments