@@ -113,12 +113,11 @@ pp.parseMaybeAssign = function(noIn, refDestructuringErrors, afterLeftParse) {
113
113
else this . exprAllowed = false
114
114
}
115
115
116
- let ownDestructuringErrors = false , oldParenAssign = - 1 , oldTrailingComma = - 1 , oldShorthandAssign = - 1
116
+ let ownDestructuringErrors = false , oldParenAssign = - 1 , oldTrailingComma = - 1
117
117
if ( refDestructuringErrors ) {
118
118
oldParenAssign = refDestructuringErrors . parenthesizedAssign
119
119
oldTrailingComma = refDestructuringErrors . trailingComma
120
- oldShorthandAssign = refDestructuringErrors . shorthandAssign
121
- refDestructuringErrors . parenthesizedAssign = refDestructuringErrors . trailingComma = refDestructuringErrors . shorthandAssign = - 1
120
+ refDestructuringErrors . parenthesizedAssign = refDestructuringErrors . trailingComma = - 1
122
121
} else {
123
122
refDestructuringErrors = new DestructuringErrors
124
123
ownDestructuringErrors = true
@@ -133,8 +132,11 @@ pp.parseMaybeAssign = function(noIn, refDestructuringErrors, afterLeftParse) {
133
132
let node = this . startNodeAt ( startPos , startLoc )
134
133
node . operator = this . value
135
134
node . left = this . type === tt . eq ? this . toAssignable ( left , false , refDestructuringErrors ) : left
136
- if ( ! ownDestructuringErrors ) DestructuringErrors . call ( refDestructuringErrors )
137
- refDestructuringErrors . shorthandAssign = - 1 // reset because shorthand default was used correctly
135
+ if ( ! ownDestructuringErrors ) {
136
+ refDestructuringErrors . parenthesizedAssign = refDestructuringErrors . trailingComma = refDestructuringErrors . doubleProto = - 1
137
+ }
138
+ if ( refDestructuringErrors . shorthandAssign >= node . left . start )
139
+ refDestructuringErrors . shorthandAssign = - 1 // reset because shorthand default was used correctly
138
140
this . checkLVal ( left )
139
141
this . next ( )
140
142
node . right = this . parseMaybeAssign ( noIn )
@@ -144,7 +146,6 @@ pp.parseMaybeAssign = function(noIn, refDestructuringErrors, afterLeftParse) {
144
146
}
145
147
if ( oldParenAssign > - 1 ) refDestructuringErrors . parenthesizedAssign = oldParenAssign
146
148
if ( oldTrailingComma > - 1 ) refDestructuringErrors . trailingComma = oldTrailingComma
147
- if ( oldShorthandAssign > - 1 ) refDestructuringErrors . shorthandAssign = oldShorthandAssign
148
149
return left
149
150
}
150
151
@@ -249,8 +250,8 @@ pp.parseMaybeUnary = function(refDestructuringErrors, sawUnary) {
249
250
pp . parseExprSubscripts = function ( refDestructuringErrors ) {
250
251
let startPos = this . start , startLoc = this . startLoc
251
252
let expr = this . parseExprAtom ( refDestructuringErrors )
252
- let skipArrowSubscripts = expr . type === "ArrowFunctionExpression" && this . input . slice ( this . lastTokStart , this . lastTokEnd ) !== ")"
253
- if ( this . checkExpressionErrors ( refDestructuringErrors ) || skipArrowSubscripts ) return expr
253
+ if ( expr . type === "ArrowFunctionExpression" && this . input . slice ( this . lastTokStart , this . lastTokEnd ) !== ")" )
254
+ return expr
254
255
let result = this . parseSubscripts ( expr , startPos , startLoc )
255
256
if ( refDestructuringErrors && result . type === "MemberExpression" ) {
256
257
if ( refDestructuringErrors . parenthesizedAssign >= result . start ) refDestructuringErrors . parenthesizedAssign = - 1
0 commit comments