File tree Expand file tree Collapse file tree 1 file changed +4
-15
lines changed Expand file tree Collapse file tree 1 file changed +4
-15
lines changed Original file line number Diff line number Diff line change @@ -11444,9 +11444,10 @@ namespace ts {
11444
11444
forEach(node.declarationList.declarations, checkSourceElement);
11445
11445
}
11446
11446
11447
- function checkGrammarDisallowedModifiersInBlockOrObjectLiteralExpression (node: Node) {
11447
+ function checkGrammarDisallowedModifiersOnMethodInObjectLiteralExpression (node: Node) {
11448
11448
if (node.modifiers) {
11449
- if (inObjectLiteralExpression(node)) {
11449
+ if (node.parent.kind === SyntaxKind.ObjectLiteralExpression){
11450
+ // If this method declaration is a property of object-literal-expression
11450
11451
if (isAsyncFunctionLike(node)) {
11451
11452
if (node.modifiers.length > 1) {
11452
11453
return grammarErrorOnFirstToken(node, Diagnostics.Modifiers_cannot_appear_here);
@@ -11459,18 +11460,6 @@ namespace ts {
11459
11460
}
11460
11461
}
11461
11462
11462
- function inObjectLiteralExpression(node: Node) {
11463
- while (node) {
11464
- if (node.kind === SyntaxKind.ObjectLiteralExpression) {
11465
- return true;
11466
- }
11467
-
11468
- node = node.parent;
11469
- }
11470
-
11471
- return false;
11472
- }
11473
-
11474
11463
function checkExpressionStatement(node: ExpressionStatement) {
11475
11464
// Grammar checking
11476
11465
checkGrammarStatementInAmbientContext(node);
@@ -15026,7 +15015,7 @@ namespace ts {
15026
15015
}
15027
15016
15028
15017
function checkGrammarMethod(node: MethodDeclaration) {
15029
- if (checkGrammarDisallowedModifiersInBlockOrObjectLiteralExpression (node) ||
15018
+ if (checkGrammarDisallowedModifiersOnMethodInObjectLiteralExpression (node) ||
15030
15019
checkGrammarFunctionLikeDeclaration(node) ||
15031
15020
checkGrammarForGenerator(node)) {
15032
15021
return true;
You can’t perform that action at this time.
0 commit comments