@@ -233,7 +233,13 @@ pp.readToken_mult_modulo_exp = function(code) { // '%*'
233233
234234pp . readToken_pipe_amp = function ( code ) { // '|&'
235235 let next = this . input . charCodeAt ( this . pos + 1 )
236- if ( next === code ) return this . finishOp ( code === 124 ? tt . logicalOR : tt . logicalAND , 2 )
236+ if ( next === code ) {
237+ if ( this . options . ecmaVersion >= 12 ) {
238+ let next2 = this . input . charCodeAt ( this . pos + 2 )
239+ if ( next2 === 61 ) return this . finishOp ( tt . assign , 3 )
240+ }
241+ return this . finishOp ( code === 124 ? tt . logicalOR : tt . logicalAND , 2 )
242+ }
237243 if ( next === 61 ) return this . finishOp ( tt . assign , 2 )
238244 return this . finishOp ( code === 124 ? tt . bitwiseOR : tt . bitwiseAND , 1 )
239245}
@@ -290,13 +296,20 @@ pp.readToken_eq_excl = function(code) { // '=!'
290296}
291297
292298pp . readToken_question = function ( ) { // '?'
293- if ( this . options . ecmaVersion >= 11 ) {
299+ const ecmaVersion = this . options . ecmaVersion
300+ if ( ecmaVersion >= 11 ) {
294301 let next = this . input . charCodeAt ( this . pos + 1 )
295302 if ( next === 46 ) {
296303 let next2 = this . input . charCodeAt ( this . pos + 2 )
297304 if ( next2 < 48 || next2 > 57 ) return this . finishOp ( tt . questionDot , 2 )
298305 }
299- if ( next === 63 ) return this . finishOp ( tt . coalesce , 2 )
306+ if ( next === 63 ) {
307+ if ( ecmaVersion >= 12 ) {
308+ let next2 = this . input . charCodeAt ( this . pos + 2 )
309+ if ( next2 === 61 ) return this . finishOp ( tt . assign , 3 )
310+ }
311+ return this . finishOp ( tt . coalesce , 2 )
312+ }
300313 }
301314 return this . finishOp ( tt . question , 1 )
302315}
0 commit comments