@@ -11444,19 +11444,17 @@ namespace ts {
11444
11444
forEach(node.declarationList.declarations, checkSourceElement);
11445
11445
}
11446
11446
11447
- function checkGrammarDisallowedModifiersOnMethodInObjectLiteralExpression(node: Node) {
11448
- if (node.modifiers) {
11449
- if (node.parent.kind === SyntaxKind.ObjectLiteralExpression){
11450
- // If this method declaration is a property of object-literal-expression
11451
- if (isAsyncFunctionLike(node)) {
11452
- if (node.modifiers.length > 1) {
11453
- return grammarErrorOnFirstToken(node, Diagnostics.Modifiers_cannot_appear_here);
11454
- }
11455
- }
11456
- else {
11447
+ function checkGrammarDisallowedModifiersOnObjectLiteralExpressionMethod(node: Node) {
11448
+ // We only disallow modifier on a method declaration if it is a property of object-literal-expression
11449
+ if (node.modifiers && node.parent.kind === SyntaxKind.ObjectLiteralExpression){
11450
+ if (isAsyncFunctionLike(node)) {
11451
+ if (node.modifiers.length > 1) {
11457
11452
return grammarErrorOnFirstToken(node, Diagnostics.Modifiers_cannot_appear_here);
11458
11453
}
11459
11454
}
11455
+ else {
11456
+ return grammarErrorOnFirstToken(node, Diagnostics.Modifiers_cannot_appear_here);
11457
+ }
11460
11458
}
11461
11459
}
11462
11460
@@ -15015,7 +15013,7 @@ namespace ts {
15015
15013
}
15016
15014
15017
15015
function checkGrammarMethod(node: MethodDeclaration) {
15018
- if (checkGrammarDisallowedModifiersOnMethodInObjectLiteralExpression (node) ||
15016
+ if (checkGrammarDisallowedModifiersOnObjectLiteralExpressionMethod (node) ||
15019
15017
checkGrammarFunctionLikeDeclaration(node) ||
15020
15018
checkGrammarForGenerator(node)) {
15021
15019
return true;
0 commit comments