@@ -4132,7 +4132,11 @@ function parseThrowStatement() {
4132
4132
4133
4133
function parseCatchClause ( ) {
4134
4134
var param , body ,
4135
- marker = markerCreate ( ) ;
4135
+ marker = markerCreate ( ) ,
4136
+ allowDestructuring = extra . ecmaFeatures . destructuring ,
4137
+ options = {
4138
+ paramSet : new StringMap ( )
4139
+ } ;
4136
4140
4137
4141
expectKeyword ( "catch" ) ;
4138
4142
@@ -4141,9 +4145,25 @@ function parseCatchClause() {
4141
4145
throwUnexpected ( lookahead ) ;
4142
4146
}
4143
4147
4144
- param = parseVariableIdentifier ( ) ;
4148
+ if ( match ( "[" ) ) {
4149
+ if ( ! allowDestructuring ) {
4150
+ throwUnexpected ( lookahead ) ;
4151
+ }
4152
+ param = parseArrayInitialiser ( ) ;
4153
+ reinterpretAsDestructuredParameter ( options , param ) ;
4154
+ } else if ( match ( "{" ) ) {
4155
+
4156
+ if ( ! allowDestructuring ) {
4157
+ throwUnexpected ( lookahead ) ;
4158
+ }
4159
+ param = parseObjectInitialiser ( ) ;
4160
+ reinterpretAsDestructuredParameter ( options , param ) ;
4161
+ } else {
4162
+ param = parseVariableIdentifier ( ) ;
4163
+ }
4164
+
4145
4165
// 12.14.1
4146
- if ( strict && syntax . isRestrictedWord ( param . name ) ) {
4166
+ if ( strict && param . name && syntax . isRestrictedWord ( param . name ) ) {
4147
4167
throwErrorTolerant ( { } , Messages . StrictCatchVariable ) ;
4148
4168
}
4149
4169
0 commit comments