diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 4f3cebc1e8..320f65ba58 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -1350,13 +1350,8 @@ module ts { return speculationHelper(callback, /*isLookAhead:*/ false); } - // The function takes a flag "considerStrictModeContext" because in the case of parsing - // an identifier, we don't want to consider whether we are in strict mode. This is because - // if the identifier violates strict-mode reserved word, we want to report more explicit error - // in the checker. - // However, in some cases such as isLetDeclaration, we want to know at the parse time whether - // next token is really an identifier in strict mode and report an error. - function isIdentifier(considerStrictModeContext = true): boolean { + // Ignore strict mode flag because we will be report an error in type checker instead. + function isIdentifier(): boolean { if (token === SyntaxKind.Identifier) { return true; } @@ -1367,12 +1362,7 @@ module ts { return false; } - if (considerStrictModeContext) { - return inStrictModeContext() ? token > SyntaxKind.LastFutureReservedWord : token > SyntaxKind.LastReservedWord; - } - else { - return token > SyntaxKind.LastReservedWord; - } + return token > SyntaxKind.LastReservedWord; } function parseExpected(kind: SyntaxKind, diagnosticMessage?: DiagnosticMessage): boolean { @@ -1510,7 +1500,7 @@ module ts { } function parseIdentifier(diagnosticMessage?: DiagnosticMessage): Identifier { - return createIdentifier(isIdentifier(/*considerStrictModeContext*/ false), diagnosticMessage); + return createIdentifier(isIdentifier(), diagnosticMessage); } function parseIdentifierName(): Identifier {