487487 SCOPE_SUPER  =  64 , 
488488 SCOPE_DIRECT_SUPER  =  128 , 
489489 SCOPE_CLASS_STATIC_BLOCK  =  256 , 
490+  SCOPE_CLASS_FIELD_INIT  =  512 , 
490491 SCOPE_VAR  =  SCOPE_TOP  |  SCOPE_FUNCTION  |  SCOPE_CLASS_STATIC_BLOCK ; 
491492
492493function  functionFlags ( async ,  generator )  { 
@@ -597,35 +598,38 @@ Parser.prototype.parse = function parse () {
597598
598599prototypeAccessors . inFunction . get  =  function  ( )  {  return  ( this . currentVarScope ( ) . flags  &  SCOPE_FUNCTION )  >  0  } ; 
599600
600- prototypeAccessors . inGenerator . get  =  function  ( )  {  return  ( this . currentVarScope ( ) . flags  &  SCOPE_GENERATOR )  >  0  &&   ! this . currentVarScope ( ) . inClassFieldInit   } ; 
601+ prototypeAccessors . inGenerator . get  =  function  ( )  {  return  ( this . currentVarScope ( ) . flags  &  SCOPE_GENERATOR )  >  0  } ; 
601602
602- prototypeAccessors . inAsync . get  =  function  ( )  {  return  ( this . currentVarScope ( ) . flags  &  SCOPE_ASYNC )  >  0  &&   ! this . currentVarScope ( ) . inClassFieldInit   } ; 
603+ prototypeAccessors . inAsync . get  =  function  ( )  {  return  ( this . currentVarScope ( ) . flags  &  SCOPE_ASYNC )  >  0  } ; 
603604
604605prototypeAccessors . canAwait . get  =  function  ( )  { 
605606 for  ( var  i  =  this . scopeStack . length  -  1 ;  i  >=  0 ;  i -- )  { 
606-  var  scope  =  this . scopeStack [ i ] ; 
607-  if  ( scope . inClassFieldInit  ||  scope . flags  &  SCOPE_CLASS_STATIC_BLOCK )  {  return  false  } 
608-  if  ( scope . flags  &  SCOPE_FUNCTION )  {  return  ( scope . flags  &  SCOPE_ASYNC )  >  0  } 
607+  var  ref  =  this . scopeStack [ i ] ; 
608+  var  flags  =  ref . flags ; 
609+  if  ( flags  &  ( SCOPE_CLASS_STATIC_BLOCK  |  SCOPE_CLASS_FIELD_INIT ) )  {  return  false  } 
610+  if  ( flags  &  SCOPE_FUNCTION )  {  return  ( flags  &  SCOPE_ASYNC )  >  0  } 
609611 } 
610612 return  ( this . inModule  &&  this . options . ecmaVersion  >=  13 )  ||  this . options . allowAwaitOutsideFunction 
611613} ; 
612614
613615prototypeAccessors . allowSuper . get  =  function  ( )  { 
614616 var  ref  =  this . currentThisScope ( ) ; 
615617 var  flags  =  ref . flags ; 
616-  var  inClassFieldInit  =  ref . inClassFieldInit ; 
617-  return  ( flags  &  SCOPE_SUPER )  >  0  ||  inClassFieldInit  ||  this . options . allowSuperOutsideMethod 
618+  return  ( flags  &  SCOPE_SUPER )  >  0  ||  this . options . allowSuperOutsideMethod 
618619} ; 
619620
620621prototypeAccessors . allowDirectSuper . get  =  function  ( )  {  return  ( this . currentThisScope ( ) . flags  &  SCOPE_DIRECT_SUPER )  >  0  } ; 
621622
622623prototypeAccessors . treatFunctionsAsVar . get  =  function  ( )  {  return  this . treatFunctionsAsVarInScope ( this . currentScope ( ) )  } ; 
623624
624625prototypeAccessors . allowNewDotTarget . get  =  function  ( )  { 
625-  var  ref  =  this . currentThisScope ( ) ; 
626-  var  flags  =  ref . flags ; 
627-  var  inClassFieldInit  =  ref . inClassFieldInit ; 
628-  return  ( flags  &  ( SCOPE_FUNCTION  |  SCOPE_CLASS_STATIC_BLOCK ) )  >  0  ||  inClassFieldInit 
626+  for  ( var  i  =  this . scopeStack . length  -  1 ;  i  >=  0 ;  i -- )  { 
627+  var  ref  =  this . scopeStack [ i ] ; 
628+  var  flags  =  ref . flags ; 
629+  if  ( flags  &  ( SCOPE_CLASS_STATIC_BLOCK  |  SCOPE_CLASS_FIELD_INIT )  || 
630+  ( ( flags  &  SCOPE_FUNCTION )  &&  ! ( flags  &  SCOPE_ARROW ) ) )  {  return  true  } 
631+  } 
632+  return  false 
629633} ; 
630634
631635prototypeAccessors . inClassStaticBlock . get  =  function  ( )  { 
@@ -1552,11 +1556,9 @@ pp$8.parseClassField = function(field) {
15521556
15531557 if  ( this . eat ( types$1 . eq ) )  { 
15541558 // To raise SyntaxError if 'arguments' exists in the initializer. 
1555-  var  scope  =  this . currentThisScope ( ) ; 
1556-  var  inClassFieldInit  =  scope . inClassFieldInit ; 
1557-  scope . inClassFieldInit  =  true ; 
1559+  this . enterScope ( SCOPE_CLASS_FIELD_INIT  |  SCOPE_SUPER ) ; 
15581560 field . value  =  this . parseMaybeAssign ( ) ; 
1559-  scope . inClassFieldInit   =   inClassFieldInit ; 
1561+  this . exitScope ( ) ; 
15601562 }  else  { 
15611563 field . value  =  null ; 
15621564 } 
@@ -1698,6 +1700,8 @@ pp$8.parseExport = function(node, exports) {
16981700 {  this . checkExport ( exports ,  node . declaration . id ,  node . declaration . id . start ) ;  } 
16991701 node . specifiers  =  [ ] ; 
17001702 node . source  =  null ; 
1703+  if  ( this . options . ecmaVersion  >=  16 ) 
1704+  {  node . attributes  =  [ ] ;  } 
17011705 }  else  {  // export { x, y as z } [from '...'] 
17021706 node . declaration  =  null ; 
17031707 node . specifiers  =  this . parseExportSpecifiers ( exports ) ; 
@@ -1721,6 +1725,8 @@ pp$8.parseExport = function(node, exports) {
17211725 } 
17221726
17231727 node . source  =  null ; 
1728+  if  ( this . options . ecmaVersion  >=  16 ) 
1729+  {  node . attributes  =  [ ] ;  } 
17241730 } 
17251731 this . semicolon ( ) ; 
17261732 } 
@@ -3300,9 +3306,10 @@ pp$5.parseProperty = function(isPattern, refDestructuringErrors) {
33003306} ; 
33013307
33023308pp$5 . parseGetterSetter  =  function ( prop )  { 
3303-  prop . kind  =  prop . key . name ; 
3309+  var   kind  =  prop . key . name ; 
33043310 this . parsePropertyName ( prop ) ; 
33053311 prop . value  =  this . parseMethod ( false ) ; 
3312+  prop . kind  =  kind ; 
33063313 var  paramCount  =  prop . kind  ===  "get"  ? 0  : 1 ; 
33073314 if  ( prop . value . params . length  !==  paramCount )  { 
33083315 var  start  =  prop . value . start ; 
@@ -3325,9 +3332,9 @@ pp$5.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startP
33253332 prop . kind  =  "init" ; 
33263333 }  else  if  ( this . options . ecmaVersion  >=  6  &&  this . type  ===  types$1 . parenL )  { 
33273334 if  ( isPattern )  {  this . unexpected ( ) ;  } 
3328-  prop . kind  =  "init" ; 
33293335 prop . method  =  true ; 
33303336 prop . value  =  this . parseMethod ( isGenerator ,  isAsync ) ; 
3337+  prop . kind  =  "init" ; 
33313338 }  else  if  ( ! isPattern  &&  ! containsEsc  && 
33323339 this . options . ecmaVersion  >=  5  &&  ! prop . computed  &&  prop . key . type  ===  "Identifier"  && 
33333340 ( prop . key . name  ===  "get"  ||  prop . key . name  ===  "set" )  && 
@@ -3339,7 +3346,6 @@ pp$5.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startP
33393346 this . checkUnreserved ( prop . key ) ; 
33403347 if  ( prop . key . name  ===  "await"  &&  ! this . awaitIdentPos ) 
33413348 {  this . awaitIdentPos  =  startPos ;  } 
3342-  prop . kind  =  "init" ; 
33433349 if  ( isPattern )  { 
33443350 prop . value  =  this . parseMaybeDefault ( startPos ,  startLoc ,  this . copyNode ( prop . key ) ) ; 
33453351 }  else  if  ( this . type  ===  types$1 . eq  &&  refDestructuringErrors )  { 
@@ -3349,6 +3355,7 @@ pp$5.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startP
33493355 }  else  { 
33503356 prop . value  =  this . copyNode ( prop . key ) ; 
33513357 } 
3358+  prop . kind  =  "init" ; 
33523359 prop . shorthand  =  true ; 
33533360 }  else  {  this . unexpected ( ) ;  } 
33543361} ; 
@@ -3524,7 +3531,7 @@ pp$5.checkUnreserved = function(ref) {
35243531 {  this . raiseRecoverable ( start ,  "Cannot use 'yield' as identifier inside a generator" ) ;  } 
35253532 if  ( this . inAsync  &&  name  ===  "await" ) 
35263533 {  this . raiseRecoverable ( start ,  "Cannot use 'await' as identifier inside an async function" ) ;  } 
3527-  if  ( this . currentThisScope ( ) . inClassFieldInit  &&  name  ===  "arguments" ) 
3534+  if  ( ! ( this . currentThisScope ( ) . flags   &   SCOPE_VAR )  &&  name  ===  "arguments" ) 
35283535 {  this . raiseRecoverable ( start ,  "Cannot use 'arguments' in class field initializer" ) ;  } 
35293536 if  ( this . inClassStaticBlock  &&  ( name  ===  "arguments"  ||  name  ===  "await" ) ) 
35303537 {  this . raise ( start ,  ( "Cannot use "  +  name  +  " in class static initialization block" ) ) ;  } 
@@ -3637,6 +3644,9 @@ var pp$4 = Parser.prototype;
36373644pp$4 . raise  =  function ( pos ,  message )  { 
36383645 var  loc  =  getLineInfo ( this . input ,  pos ) ; 
36393646 message  +=  " ("  +  loc . line  +  ":"  +  loc . column  +  ")" ; 
3647+  if  ( this . sourceFile )  { 
3648+  message  +=  " in "  +  this . sourceFile ; 
3649+  } 
36403650 var  err  =  new  SyntaxError ( message ) ; 
36413651 err . pos  =  pos ;  err . loc  =  loc ;  err . raisedAt  =  this . pos ; 
36423652 throw  err 
@@ -3660,8 +3670,6 @@ var Scope = function Scope(flags) {
36603670 this . lexical  =  [ ] ; 
36613671 // A list of lexically-declared FunctionDeclaration names in the current lexical scope 
36623672 this . functions  =  [ ] ; 
3663-  // A switch to disallow the identifier reference 'arguments' 
3664-  this . inClassFieldInit  =  false ; 
36653673} ; 
36663674
36673675// The functions in this module keep track of declared variables in the current scope in order to detect duplicate variable names. 
@@ -3731,15 +3739,16 @@ pp$3.currentScope = function() {
37313739pp$3 . currentVarScope  =  function ( )  { 
37323740 for  ( var  i  =  this . scopeStack . length  -  1 ; ;  i -- )  { 
37333741 var  scope  =  this . scopeStack [ i ] ; 
3734-  if  ( scope . flags  &  SCOPE_VAR )  {  return  scope  } 
3742+  if  ( scope . flags  &  ( SCOPE_VAR   |   SCOPE_CLASS_FIELD_INIT   |   SCOPE_CLASS_STATIC_BLOCK ) )  {  return  scope  } 
37353743 } 
37363744} ; 
37373745
37383746// Could be useful for `this`, `new.target`, `super()`, `super.property`, and `super[property]`. 
37393747pp$3 . currentThisScope  =  function ( )  { 
37403748 for  ( var  i  =  this . scopeStack . length  -  1 ; ;  i -- )  { 
37413749 var  scope  =  this . scopeStack [ i ] ; 
3742-  if  ( scope . flags  &  SCOPE_VAR  &&  ! ( scope . flags  &  SCOPE_ARROW ) )  {  return  scope  } 
3750+  if  ( scope . flags  &  ( SCOPE_VAR  |  SCOPE_CLASS_FIELD_INIT  |  SCOPE_CLASS_STATIC_BLOCK )  && 
3751+  ! ( scope . flags  &  SCOPE_ARROW ) )  {  return  scope  } 
37433752 } 
37443753} ; 
37453754
@@ -6093,7 +6102,7 @@ pp.readWord = function() {
60936102// [walk]: util/walk.js 
60946103
60956104
6096- var  version  =  "8.14.0 " ; 
6105+ var  version  =  "8.14.1 " ; 
60976106
60986107Parser . acorn  =  { 
60996108 Parser : Parser , 
0 commit comments