@@ -1700,7 +1700,9 @@ private Import ParseImportCall()
17001700 if ( Match ( "," ) )
17011701 {
17021702 NextToken ( ) ;
1703- attributes = ParseObjectInitializer ( ) ;
1703+
1704+ if ( ! Match ( ")" ) )
1705+ attributes = ParseAssignmentExpression ( ) ;
17041706 }
17051707
17061708 _context . IsAssignmentTarget = previousIsAssignmentTarget ;
@@ -1711,6 +1713,8 @@ private Import ParseImportCall()
17111713 }
17121714 else
17131715 {
1716+ if ( Match ( "," ) )
1717+ NextToken ( ) ;
17141718 this . Expect ( ")" ) ;
17151719 }
17161720
@@ -1787,7 +1791,7 @@ private Expression ParseLeftHandSideExpressionAllowCall()
17871791 : InheritCoverGrammar ( _parsePrimaryExpression ) ;
17881792 }
17891793
1790- if ( isSuper && ! _context . AllowSuper )
1794+ if ( isSuper && ! _context . AllowSuper && ( ! _context . InClassConstructor || ( string ? ) _lookahead . Value != "." ) )
17911795 {
17921796 TolerateError ( Messages . UnexpectedSuper ) ;
17931797 }
@@ -2074,6 +2078,10 @@ private UnaryExpression ParseBasicUnaryExpression()
20742078 {
20752079 TolerateError ( Messages . StrictDelete ) ;
20762080 }
2081+ if ( _context . Strict && unaryExpr . Operator == UnaryOperator . Delete && unaryExpr . Argument is MemberExpression m && m . Property is PrivateIdentifier )
2082+ {
2083+ TolerateError ( Messages . PrivateFieldNoDelete ) ;
2084+ }
20772085
20782086 _context . IsAssignmentTarget = false ;
20792087 _context . IsBindingElement = false ;
@@ -4715,7 +4723,7 @@ private ClassElement ParseClassElement(ref bool hasConstructor)
47154723 token = _lookahead ;
47164724 }
47174725 }
4718- key = ParseObjectPropertyKey ( ) ;
4726+ key = ParseObjectPropertyKey ( isPrivate ) ;
47194727 }
47204728 else if ( Match ( "{" ) )
47214729 {
@@ -4770,7 +4778,8 @@ private ClassElement ParseClassElement(ref bool hasConstructor)
47704778 }
47714779
47724780 var lookaheadPropertyKey = QualifiedPropertyName ( _lookahead ) ;
4773- if ( token . Type == TokenType . Identifier )
4781+ if ( token . Type == TokenType . Identifier ||
4782+ ( token . Type == TokenType . Punctuator && ( string ? ) token . Value != "*" ) )
47744783 {
47754784 if ( lookaheadPropertyKey && ( string ? ) token . Value == "get" )
47764785 {
@@ -4808,12 +4817,16 @@ private ClassElement ParseClassElement(ref bool hasConstructor)
48084817 else if ( ! Match ( "(" ) )
48094818 {
48104819 kind = PropertyKind . Property ;
4811- computed = false ;
4812-
4820+
48134821 if ( Match ( "=" ) )
48144822 {
48154823 NextToken ( ) ;
4824+ if ( _lookahead . Type == TokenType . Identifier && ( string ? ) _lookahead . Value == "arguments" )
4825+ ThrowUnexpectedToken ( token , Messages . ArgumentsNotAllowedInClassField ) ;
4826+ var previousAllowSuper = _context . AllowSuper ;
4827+ _context . AllowSuper = true ;
48164828 value = IsolateCoverGrammar ( _parseAssignmentExpression ) ;
4829+ _context . AllowSuper = previousAllowSuper ;
48174830 }
48184831 }
48194832 }
@@ -4834,15 +4847,16 @@ private ClassElement ParseClassElement(ref bool hasConstructor)
48344847 value = ParseGeneratorMethod ( isAsync ) ;
48354848 method = true ;
48364849 }
4837-
4850+
48384851 if ( kind == PropertyKind . None && key != null )
48394852 {
48404853 if ( Match ( "(" ) )
48414854 {
48424855 var previousAllowSuper = _context . AllowSuper ;
48434856 var previousInClassConstructor = _context . InClassConstructor ;
48444857 _context . InClassConstructor = Equals ( token . Value , "constructor" ) ;
4845- _context . AllowSuper = true ;
4858+ if ( ! _context . InClassConstructor )
4859+ _context . AllowSuper = true ;
48464860 kind = PropertyKind . Init ;
48474861 value = isAsync ? ParsePropertyMethodAsyncFunction ( isGenerator ) : ParsePropertyMethodFunction ( isGenerator ) ;
48484862 _context . InClassConstructor = previousInClassConstructor ;
@@ -4942,7 +4956,7 @@ private ClassDeclaration ParseClassDeclarationCore(in Marker node, bool identifi
49424956 var previousStrict = _context . Strict ;
49434957 var previousAllowSuper = _context . AllowSuper ;
49444958 _context . Strict = true ;
4945- _context . AllowSuper = true ;
4959+ _context . AllowSuper = false ;
49464960
49474961 ExpectKeyword ( "class" ) ;
49484962
@@ -4955,6 +4969,7 @@ private ClassDeclaration ParseClassDeclarationCore(in Marker node, bool identifi
49554969 {
49564970 NextToken ( ) ;
49574971 superClass = IsolateCoverGrammar ( _parseLeftHandSideExpressionAllowCall ) ;
4972+ _context . AllowSuper = true ;
49584973 }
49594974
49604975 var classBody = ParseClassBody ( ) ;
@@ -4988,7 +5003,7 @@ private ClassExpression ParseClassExpression()
49885003 var previousStrict = _context . Strict ;
49895004 var previousAllowSuper = _context . AllowSuper ;
49905005 _context . Strict = true ;
4991- _context . AllowSuper = true ;
5006+ _context . AllowSuper = false ;
49925007
49935008 ExpectKeyword ( "class" ) ;
49945009 var id = _lookahead . Type == TokenType . Identifier
@@ -5000,6 +5015,7 @@ private ClassExpression ParseClassExpression()
50005015 {
50015016 NextToken ( ) ;
50025017 superClass = IsolateCoverGrammar ( _parseLeftHandSideExpressionAllowCall ) ;
5018+ _context . AllowSuper = true ;
50035019 }
50045020
50055021 var classBody = ParseClassBody ( ) ;
0 commit comments