Address code review

This commit is contained in:
Yui T 2015-07-08 13:56:27 -07:00
parent cdc999a6c5
commit 8e15a42632

View file

@ -11444,10 +11444,9 @@ namespace ts {
forEach(node.declarationList.declarations, checkSourceElement); forEach(node.declarationList.declarations, checkSourceElement);
} }
function checkGrammarDisallowedModifiersOnMethodInObjectLiteralExpression(node: Node) { function checkGrammarDisallowedModifiersOnObjectLiteralExpressionMethod(node: Node) {
if (node.modifiers) { // We only disallow modifier on a method declaration if it is a property of object-literal-expression
if (node.parent.kind === SyntaxKind.ObjectLiteralExpression){ if (node.modifiers && node.parent.kind === SyntaxKind.ObjectLiteralExpression){
// If this method declaration is a property of object-literal-expression
if (isAsyncFunctionLike(node)) { if (isAsyncFunctionLike(node)) {
if (node.modifiers.length > 1) { if (node.modifiers.length > 1) {
return grammarErrorOnFirstToken(node, Diagnostics.Modifiers_cannot_appear_here); return grammarErrorOnFirstToken(node, Diagnostics.Modifiers_cannot_appear_here);
@ -11458,7 +11457,6 @@ namespace ts {
} }
} }
} }
}
function checkExpressionStatement(node: ExpressionStatement) { function checkExpressionStatement(node: ExpressionStatement) {
// Grammar checking // Grammar checking
@ -15015,7 +15013,7 @@ namespace ts {
} }
function checkGrammarMethod(node: MethodDeclaration) { function checkGrammarMethod(node: MethodDeclaration) {
if (checkGrammarDisallowedModifiersOnMethodInObjectLiteralExpression(node) || if (checkGrammarDisallowedModifiersOnObjectLiteralExpressionMethod(node) ||
checkGrammarFunctionLikeDeclaration(node) || checkGrammarFunctionLikeDeclaration(node) ||
checkGrammarForGenerator(node)) { checkGrammarForGenerator(node)) {
return true; return true;