@@ -11925,7 +11925,8 @@ module ts {
11925
11925
// GRAMMAR CHECKING
11926
11926
function isReservedwordInStrictMode(node: Identifier): boolean {
11927
11927
// Check that originalKeywordKind is less than LastFurtureReservedWord to see if an Identifier is a strict-mode reserved word
11928
- return (node.parserContextFlags & ParserContextFlags.StrictMode) && node.originalKeywordKind <= SyntaxKind.LastFutureReservedWord;
11928
+ return (node.parserContextFlags & ParserContextFlags.StrictMode) &&
11929
+ (node.originalKeywordKind >= SyntaxKind.FirstFutureReservedWord && node.originalKeywordKind <= SyntaxKind.LastFutureReservedWord);
11929
11930
}
11930
11931
11931
11932
function reportStrictModeGrammarErrorInClassDeclaration(identifier: Identifier, message: DiagnosticMessage, arg0?: any, arg1?: any, arg2?: any): boolean {
@@ -12015,16 +12016,8 @@ module ts {
12015
12016
// Walk from right to left and report a possible error at each Identifier in QualifiedName
12016
12017
// Example:
12017
12018
// x1: public.private.package // error at public and private
12018
- let qualifiedName = typeName;
12019
- while (qualifiedName && qualifiedName.kind === SyntaxKind.QualifiedName) {
12020
- checkGrammarTypeNameInStrictMode((<QualifiedName>qualifiedName).right);
12021
- qualifiedName = (<QualifiedName>qualifiedName).left;
12022
- }
12023
-
12024
- // Report an error at the last Identifier in QualifiedName
12025
- // Example:
12026
- // x1: public.private.package // error at package
12027
- checkGrammarTypeNameInStrictMode(<Identifier>qualifiedName);
12019
+ checkGrammarTypeNameInStrictMode((<QualifiedName>typeName).right);
12020
+ checkGrammarTypeReferenceInStrictMode((<QualifiedName>typeName).left);
12028
12021
}
12029
12022
}
12030
12023
@@ -12034,27 +12027,18 @@ module ts {
12034
12027
// public // error at public
12035
12028
// public.private.package // error at public
12036
12029
// B.private.B // no error
12037
- function checkGrammarHeritageClauseElementInStrictMode(expression: Expression ) {
12030
+ function checkGrammarHeritageClauseElementInStrictMode(expression: PropertyAccessExpression ) {
12038
12031
// Example:
12039
12032
// class C extends public // error at public
12040
12033
if (expression && expression.kind === SyntaxKind.Identifier) {
12041
12034
return checkGrammarIdentifierInStrictMode(expression);
12042
12035
}
12043
12036
else if (expression && expression.kind === SyntaxKind.PropertyAccessExpression) {
12044
- let propertyAccessExp = <PropertyAccessExpression>expression;
12045
-
12046
12037
// Walk from left to right in PropertyAccessExpression until we are at the left most expression
12047
12038
// in PropertyAccessExpression. According to grammar production of MemberExpression,
12048
12039
// the left component expression is a PrimaryExpression (i.e. Identifier) while the other
12049
12040
// component after dots can be IdentifierName.
12050
- while (propertyAccessExp && propertyAccessExp.kind === SyntaxKind.PropertyAccessExpression) {
12051
- propertyAccessExp = <PropertyAccessExpression>propertyAccessExp.expression;
12052
- }
12053
-
12054
- // Report strict mode at the property of memberExpression
12055
- // Example:
12056
- // public.private.package // error at public as it is parsed as an Identifier in the PropertyAccessExpression
12057
- checkGrammarIdentifierInStrictMode(propertyAccessExp);
12041
+ checkGrammarHeritageClauseElementInStrictMode(<PropertyAccessExpression>expression.expression);
12058
12042
}
12059
12043
12060
12044
}
0 commit comments