From fe92b5e736778ad8552205257ae9ca8d64dbd862 Mon Sep 17 00:00:00 2001 From: Yui T Date: Sat, 13 Dec 2014 20:57:38 -0800 Subject: [PATCH] Move grammar checking: parameter; there are still errors from incomplete grammar migration --- src/compiler/checker.ts | 10 ++++++++++ src/compiler/parser.ts | 4 ++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index e3d78092282..3252c2e72f2 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -7101,6 +7101,16 @@ module ts { } function checkParameter(node: ParameterDeclaration) { + // Grammar checking + // It is a SyntaxError if the Identifier "eval" or the Identifier "arguments" occurs as the + // Identifier in a PropertySetParameterList of a PropertyAssignment that is contained in strict code + // or if its FunctionBody is strict code(11.1.5). + // It is a SyntaxError if the identifier eval or arguments appears within a FormalParameterList of a + // strict mode FunctionLikeDeclaration or FunctionExpression(13.1) + if (!checkGrammarModifiers(node) && (node.parserContextFlags & ParserContextFlags.StrictMode && isEvalOrArgumentsIdentifier(node.name))) { + reportGrammarErrorOfInvalidUseInStrictMode(node.name); + } + checkVariableLikeDeclaration(node); var func = getContainingFunction(node); if (node.flags & (NodeFlags.Public | NodeFlags.Private | NodeFlags.Protected)) { diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 22028913157..3f4482b0f69 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -4659,7 +4659,7 @@ module ts { case SyntaxKind.ModuleDeclaration: return checkModuleDeclaration(node); //case SyntaxKind.ObjectLiteralExpression: return checkObjectLiteralExpression(node); //case SyntaxKind.NumericLiteral: return checkNumericLiteral(node); - case SyntaxKind.Parameter: return checkParameter(node); + //case SyntaxKind.Parameter: return checkParameter(node); case SyntaxKind.PostfixUnaryExpression: return checkPostfixUnaryExpression(node); case SyntaxKind.PrefixUnaryExpression: return checkPrefixUnaryExpression(node); case SyntaxKind.PropertyDeclaration: @@ -5337,7 +5337,7 @@ module ts { case SyntaxKind.FunctionDeclaration: case SyntaxKind.TypeAliasDeclaration: case SyntaxKind.ImportDeclaration: - case SyntaxKind.Parameter: + //case SyntaxKind.Parameter: break; default: return false;