@@ -1114,9 +1114,9 @@ private FunctionExpression ParseClassMethod(Symbol? functionName, Token methodNa
11141114 bool isAsync )
11151115 {
11161116 Consume ( TokenType . LeftParen , "Expected '(' after method name." ) ;
1117+ using var _ = EnterFunctionContext ( isAsync , isGenerator ) ;
11171118 var parameters = ParseParameterList ( ) ;
11181119 Consume ( TokenType . RightParen , "Expected ')' after method parameters." ) ;
1119- using var _ = EnterFunctionContext ( isAsync , isGenerator ) ;
11201120 var body = ParseBlock ( ) ;
11211121 var source = body . Source ?? CreateSourceReference ( methodNameToken ) ;
11221122 return new FunctionExpression ( source , functionName , parameters , body , isAsync , isGenerator ,
@@ -2865,9 +2865,9 @@ private ExpressionNode ParseObjectLiteral()
28652865 if ( Check ( TokenType . LeftParen ) )
28662866 {
28672867 Advance ( ) ; // (
2868+ using var _ = EnterFunctionContext ( true , isAsyncGeneratorMethod ) ;
28682869 var parameters = ParseParameterList ( ) ;
28692870 Consume ( TokenType . RightParen , "Expected ')' after method parameters." ) ;
2870- using var _ = EnterFunctionContext ( true , isAsyncGeneratorMethod ) ;
28712871 var body = ParseBlock ( ) ;
28722872 var asyncMethod = new FunctionExpression ( body . Source ?? asyncKeySource , null , parameters ,
28732873 body ,
@@ -2920,9 +2920,9 @@ private ExpressionNode ParseObjectLiteral()
29202920
29212921 if ( Match ( TokenType . LeftParen ) )
29222922 {
2923+ using var _ = EnterFunctionContext ( false , isGeneratorMethod ) ;
29232924 var parameters = ParseParameterList ( ) ;
29242925 Consume ( TokenType . RightParen , "Expected ')' after method parameters." ) ;
2925- using var _ = EnterFunctionContext ( false , isGeneratorMethod ) ;
29262926 var body = ParseBlock ( ) ;
29272927 method = new FunctionExpression ( body . Source , null , parameters , body , false , isGeneratorMethod ) ;
29282928 kind = ObjectMemberKind . Method ;
@@ -3199,6 +3199,7 @@ private ExpressionNode ParseFunctionExpression(Symbol? explicitName = null, bool
31993199
32003200 private FunctionExpression ParseFunctionTail ( Symbol ? name , Token startToken , bool isAsync , bool isGenerator )
32013201 {
3202+ using var _ = EnterFunctionContext ( isAsync , isGenerator ) ;
32023203 Consume ( TokenType . LeftParen , "Expected '(' after function name." ) ;
32033204 var parameters = ParseParameterList ( ) ;
32043205 Consume ( TokenType . RightParen , "Expected ')' after parameters." ) ;
@@ -3224,7 +3225,6 @@ private FunctionExpression ParseFunctionTail(Symbol? name, Token startToken, boo
32243225 ValidateStrictModeParameters ( parameters ) ;
32253226 }
32263227
3227- using var _ = EnterFunctionContext ( isAsync , isGenerator ) ;
32283228 var body = ParseBlock ( leftBraceConsumed : true ) ;
32293229 var source = body . Source ?? CreateSourceReference ( startToken ) ;
32303230 return new FunctionExpression ( source , name , parameters , body , isAsync , isGenerator , WasAsync : isAsync ) ;
0 commit comments