Address code review

This commit is contained in:
Yui T 2015-04-09 14:46:02 -07:00
parent 1246dca703
commit 4b7d2f2411
18 changed files with 113 additions and 85 deletions

View File

@ -8345,12 +8345,12 @@ module ts {
// class C {
// foo(x: public){} // Error.
// }
if (node.typeName.kind === SyntaxKind.Identifier && (<Identifier>node.typeName).strictModeKind) {
if (node.typeName.kind === SyntaxKind.Identifier && (<Identifier>node.typeName).isKeywordInStrictMode) {
let typeName = <Identifier>node.typeName;
let nameText = declarationNameToString(typeName);
reportStrictModeGrammarErrorInClassDeclaration(typeName, Diagnostics.Type_expected_0_is_a_reserved_word_Class_definitions_are_automatically_in_strict_mode, nameText) ||
reportStrictModeGrammarErrorInModule(typeName, Diagnostics.Type_expected_0_is_a_reserved_word_Module_is_automatically_in_strict_mode, nameText) ||
grammarErrorOnNode(typeName, Diagnostics.Type_expected_0_is_a_reserved_word_in_strict_mode, nameText);
reportStrictModeGrammarErrorInClassDeclaration(typeName, Diagnostics.Type_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_strict_mode, nameText) ||
reportStrictModeGrammarErrorInModule(typeName, Diagnostics.Type_expected_0_is_a_reserved_word_in_strict_mode_Module_is_automatically_in_strict_mode, nameText) ||
grammarErrorOnNode(typeName, Diagnostics.Type_expected_0_is_a_reserved_word_in_strict_mode, nameText);
}
return checkTypeReferenceOrHeritageClauseElement(node);
}
@ -11960,7 +11960,7 @@ module ts {
let nameBindings = impotClause.namedBindings;
if (nameBindings.kind === SyntaxKind.NamespaceImport) {
let name = <Identifier>(<NamespaceImport>nameBindings).name;
if (name.strictModeKind) {
if (name.isKeywordInStrictMode) {
let nameText = declarationNameToString(name);
return grammarErrorOnNode(name, Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode, nameText);
}
@ -11969,7 +11969,7 @@ module ts {
let reportError = false;
for (let element of (<NamedImports>nameBindings).elements) {
let name = element.name;
if (name.strictModeKind) {
if (name.isKeywordInStrictMode) {
let nameText = declarationNameToString(name);
reportError = grammarErrorOnNode(name, Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode, nameText);
}
@ -11983,7 +11983,7 @@ module ts {
function checkGrammarDeclarationNameInStrictMode(node: Declaration): boolean {
let name = node.name;
if (name && name.kind === SyntaxKind.Identifier && (<Identifier>name).strictModeKind) {
if (name && name.kind === SyntaxKind.Identifier && (<Identifier>name).isKeywordInStrictMode) {
let nameText = declarationNameToString(name);
switch (node.kind) {
case SyntaxKind.Parameter:
@ -11994,18 +11994,18 @@ module ts {
case SyntaxKind.InterfaceDeclaration:
case SyntaxKind.TypeAliasDeclaration:
case SyntaxKind.EnumDeclaration:
let reportError = reportStrictModeGrammarErrorInClassDeclaration(<Identifier>name, Diagnostics.Identifier_expected_0_is_a_reserved_word_Class_definitions_are_automatically_in_strict_mode, nameText) ||
reportStrictModeGrammarErrorInModule(<Identifier>name, Diagnostics.Identifier_expected_0_is_a_reserved_word_Module_is_automatically_in_strict_mode, nameText) ||
let reportError = reportStrictModeGrammarErrorInClassDeclaration(<Identifier>name, Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_strict_mode, nameText) ||
reportStrictModeGrammarErrorInModule(<Identifier>name, Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode_Module_is_automatically_in_strict_mode, nameText) ||
grammarErrorOnNode(name, Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode, nameText);
return reportError ? reportError : false;
case SyntaxKind.ClassDeclaration:
// Report an error if the class declaration uses strict-mode reserved word.
return grammarErrorOnNode(name, Diagnostics.Identifier_expected_0_is_a_reserved_word_Class_definitions_are_automatically_in_strict_mode, nameText);
return grammarErrorOnNode(name, Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_strict_mode, nameText);
case SyntaxKind.ModuleDeclaration:
// Report an error if the module declaration uses strict-mode reserved word.
return grammarErrorOnNode(name, Diagnostics.Identifier_expected_0_is_a_reserved_word_Module_is_automatically_in_strict_mode, nameText);
return grammarErrorOnNode(name, Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode_Module_is_automatically_in_strict_mode, nameText);
case SyntaxKind.ImportEqualsDeclaration:
return grammarErrorOnNode(name, Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode, nameText);
@ -12015,7 +12015,7 @@ module ts {
}
function checkGrammarExpressionInStrictMode(node: Expression): boolean {
if (node.kind === SyntaxKind.Identifier && (<Identifier>node).strictModeKind) {
if (node.kind === SyntaxKind.Identifier && (<Identifier>node).isKeywordInStrictMode) {
let nameText = declarationNameToString(<Identifier>node);
return grammarErrorOnNode(node, Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode, nameText);
}

View File

@ -170,11 +170,11 @@ module ts {
Invalid_use_of_0_Class_definitions_are_automatically_in_strict_mode: { code: 1210, category: DiagnosticCategory.Error, key: "Invalid use of '{0}'. Class definitions are automatically in strict mode." },
A_class_declaration_without_the_default_modifier_must_have_a_name: { code: 1211, category: DiagnosticCategory.Error, key: "A class declaration without the 'default' modifier must have a name" },
Identifier_expected_0_is_a_reserved_word_in_strict_mode: { code: 1212, category: DiagnosticCategory.Error, key: "Identifier expected. '{0}' is a reserved word in strict mode" },
Identifier_expected_0_is_a_reserved_word_Class_definitions_are_automatically_in_strict_mode: { code: 1213, category: DiagnosticCategory.Error, key: "Identifier expected. '{0}' is a reserved word. Class definitions are automatically in strict mode." },
Identifier_expected_0_is_a_reserved_word_Module_is_automatically_in_strict_mode: { code: 1214, category: DiagnosticCategory.Error, key: "Identifier expected. '{0}' is a reserved word. Module is automatically in strict mode." },
Identifier_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_strict_mode: { code: 1213, category: DiagnosticCategory.Error, key: "Identifier expected. '{0}' is a reserved word in strict mode. Class definitions are automatically in strict mode." },
Identifier_expected_0_is_a_reserved_word_in_strict_mode_Module_is_automatically_in_strict_mode: { code: 1214, category: DiagnosticCategory.Error, key: "Identifier expected. '{0}' is a reserved word in strict mode. Module is automatically in strict mode." },
Type_expected_0_is_a_reserved_word_in_strict_mode: { code: 1215, category: DiagnosticCategory.Error, key: "Type expected. '{0}' is a reserved word in strict mode" },
Type_expected_0_is_a_reserved_word_Class_definitions_are_automatically_in_strict_mode: { code: 1216, category: DiagnosticCategory.Error, key: "Type expected. '{0}' is a reserved word. Class definitions are automatically in strict mode." },
Type_expected_0_is_a_reserved_word_Module_is_automatically_in_strict_mode: { code: 1217, category: DiagnosticCategory.Error, key: "Type expected. '{0}' is a reserved word. Module is automatically in strict mode." },
Type_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_strict_mode: { code: 1216, category: DiagnosticCategory.Error, key: "Type expected. '{0}' is a reserved word in strict mode. Class definitions are automatically in strict mode." },
Type_expected_0_is_a_reserved_word_in_strict_mode_Module_is_automatically_in_strict_mode: { code: 1217, category: DiagnosticCategory.Error, key: "Type expected. '{0}' is a reserved word in strict mode. Module is automatically in strict mode." },
Duplicate_identifier_0: { code: 2300, category: DiagnosticCategory.Error, key: "Duplicate identifier '{0}'." },
Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: DiagnosticCategory.Error, key: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." },
Static_members_cannot_reference_class_type_parameters: { code: 2302, category: DiagnosticCategory.Error, key: "Static members cannot reference class type parameters." },

View File

@ -671,11 +671,11 @@
"category": "Error",
"code": 1212
},
"Identifier expected. '{0}' is a reserved word. Class definitions are automatically in strict mode.": {
"Identifier expected. '{0}' is a reserved word in strict mode. Class definitions are automatically in strict mode.": {
"category": "Error",
"code": 1213
},
"Identifier expected. '{0}' is a reserved word. Module is automatically in strict mode.": {
"Identifier expected. '{0}' is a reserved word in strict mode. Module is automatically in strict mode.": {
"category": "Error",
"code": 1214
},
@ -683,11 +683,11 @@
"category": "Error",
"code": 1215
},
"Type expected. '{0}' is a reserved word. Class definitions are automatically in strict mode.": {
"Type expected. '{0}' is a reserved word in strict mode. Class definitions are automatically in strict mode.": {
"category": "Error",
"code": 1216
},
"Type expected. '{0}' is a reserved word. Module is automatically in strict mode.": {
"Type expected. '{0}' is a reserved word in strict mode. Module is automatically in strict mode.": {
"category": "Error",
"code": 1217
},

View File

@ -1489,7 +1489,7 @@ module ts {
// Set strictModeKind property so that we can report appropriate error later in type checker
if (inStrictModeContext() && (token > SyntaxKind.Identifier && token <= SyntaxKind.LastFutureReservedWord)) {
node.strictModeKind = token;
node.isKeywordInStrictMode = token;
}
node.text = internIdentifier(scanner.getTokenValue());
nextToken();

View File

@ -387,7 +387,7 @@ module ts {
export interface Identifier extends PrimaryExpression {
text: string; // Text of identifier (with escapes converted to characters)
strictModeKind?: SyntaxKind; // SyntaxKind set when violating strict mode reserved word
isKeywordInStrictMode?: SyntaxKind; // SyntaxKind which get set when violating strict mode reserved word
}
export interface QualifiedName extends Node {

View File

@ -1,4 +1,4 @@
tests/cases/compiler/constructorStaticParamName.ts(4,18): error TS1213: Identifier expected. 'static' is a reserved word. Class definitions are automatically in strict mode.
tests/cases/compiler/constructorStaticParamName.ts(4,18): error TS1213: Identifier expected. 'static' is a reserved word in strict mode. Class definitions are automatically in strict mode.
==== tests/cases/compiler/constructorStaticParamName.ts (1 errors) ====
@ -7,6 +7,6 @@ tests/cases/compiler/constructorStaticParamName.ts(4,18): error TS1213: Identifi
class test {
constructor (static) { }
~~~~~~
!!! error TS1213: Identifier expected. 'static' is a reserved word. Class definitions are automatically in strict mode.
!!! error TS1213: Identifier expected. 'static' is a reserved word in strict mode. Class definitions are automatically in strict mode.
}

View File

@ -1,4 +1,4 @@
tests/cases/compiler/constructorStaticParamNameErrors.ts(4,18): error TS1213: Identifier expected. 'static' is a reserved word. Class definitions are automatically in strict mode.
tests/cases/compiler/constructorStaticParamNameErrors.ts(4,18): error TS1213: Identifier expected. 'static' is a reserved word in strict mode. Class definitions are automatically in strict mode.
==== tests/cases/compiler/constructorStaticParamNameErrors.ts (1 errors) ====
@ -7,5 +7,5 @@ tests/cases/compiler/constructorStaticParamNameErrors.ts(4,18): error TS1213: Id
class test {
constructor (static) { }
~~~~~~
!!! error TS1213: Identifier expected. 'static' is a reserved word. Class definitions are automatically in strict mode.
!!! error TS1213: Identifier expected. 'static' is a reserved word in strict mode. Class definitions are automatically in strict mode.
}

View File

@ -1,12 +1,12 @@
tests/cases/compiler/convertKeywordsYes.ts(292,11): error TS1213: Identifier expected. 'implements' is a reserved word. Class definitions are automatically in strict mode.
tests/cases/compiler/convertKeywordsYes.ts(293,11): error TS1213: Identifier expected. 'interface' is a reserved word. Class definitions are automatically in strict mode.
tests/cases/compiler/convertKeywordsYes.ts(294,11): error TS1213: Identifier expected. 'let' is a reserved word. Class definitions are automatically in strict mode.
tests/cases/compiler/convertKeywordsYes.ts(296,11): error TS1213: Identifier expected. 'package' is a reserved word. Class definitions are automatically in strict mode.
tests/cases/compiler/convertKeywordsYes.ts(297,11): error TS1213: Identifier expected. 'private' is a reserved word. Class definitions are automatically in strict mode.
tests/cases/compiler/convertKeywordsYes.ts(298,11): error TS1213: Identifier expected. 'protected' is a reserved word. Class definitions are automatically in strict mode.
tests/cases/compiler/convertKeywordsYes.ts(299,11): error TS1213: Identifier expected. 'public' is a reserved word. Class definitions are automatically in strict mode.
tests/cases/compiler/convertKeywordsYes.ts(301,11): error TS1213: Identifier expected. 'static' is a reserved word. Class definitions are automatically in strict mode.
tests/cases/compiler/convertKeywordsYes.ts(303,11): error TS1213: Identifier expected. 'yield' is a reserved word. Class definitions are automatically in strict mode.
tests/cases/compiler/convertKeywordsYes.ts(292,11): error TS1213: Identifier expected. 'implements' is a reserved word in strict mode. Class definitions are automatically in strict mode.
tests/cases/compiler/convertKeywordsYes.ts(293,11): error TS1213: Identifier expected. 'interface' is a reserved word in strict mode. Class definitions are automatically in strict mode.
tests/cases/compiler/convertKeywordsYes.ts(294,11): error TS1213: Identifier expected. 'let' is a reserved word in strict mode. Class definitions are automatically in strict mode.
tests/cases/compiler/convertKeywordsYes.ts(296,11): error TS1213: Identifier expected. 'package' is a reserved word in strict mode. Class definitions are automatically in strict mode.
tests/cases/compiler/convertKeywordsYes.ts(297,11): error TS1213: Identifier expected. 'private' is a reserved word in strict mode. Class definitions are automatically in strict mode.
tests/cases/compiler/convertKeywordsYes.ts(298,11): error TS1213: Identifier expected. 'protected' is a reserved word in strict mode. Class definitions are automatically in strict mode.
tests/cases/compiler/convertKeywordsYes.ts(299,11): error TS1213: Identifier expected. 'public' is a reserved word in strict mode. Class definitions are automatically in strict mode.
tests/cases/compiler/convertKeywordsYes.ts(301,11): error TS1213: Identifier expected. 'static' is a reserved word in strict mode. Class definitions are automatically in strict mode.
tests/cases/compiler/convertKeywordsYes.ts(303,11): error TS1213: Identifier expected. 'yield' is a reserved word in strict mode. Class definitions are automatically in strict mode.
==== tests/cases/compiler/convertKeywordsYes.ts (9 errors) ====
@ -303,33 +303,33 @@ tests/cases/compiler/convertKeywordsYes.ts(303,11): error TS1213: Identifier exp
class constructor { }
class implements { }
~~~~~~~~~~
!!! error TS1213: Identifier expected. 'implements' is a reserved word. Class definitions are automatically in strict mode.
!!! error TS1213: Identifier expected. 'implements' is a reserved word in strict mode. Class definitions are automatically in strict mode.
class interface { }
~~~~~~~~~
!!! error TS1213: Identifier expected. 'interface' is a reserved word. Class definitions are automatically in strict mode.
!!! error TS1213: Identifier expected. 'interface' is a reserved word in strict mode. Class definitions are automatically in strict mode.
class let { }
~~~
!!! error TS1213: Identifier expected. 'let' is a reserved word. Class definitions are automatically in strict mode.
!!! error TS1213: Identifier expected. 'let' is a reserved word in strict mode. Class definitions are automatically in strict mode.
class module { }
class package { }
~~~~~~~
!!! error TS1213: Identifier expected. 'package' is a reserved word. Class definitions are automatically in strict mode.
!!! error TS1213: Identifier expected. 'package' is a reserved word in strict mode. Class definitions are automatically in strict mode.
class private { }
~~~~~~~
!!! error TS1213: Identifier expected. 'private' is a reserved word. Class definitions are automatically in strict mode.
!!! error TS1213: Identifier expected. 'private' is a reserved word in strict mode. Class definitions are automatically in strict mode.
class protected { }
~~~~~~~~~
!!! error TS1213: Identifier expected. 'protected' is a reserved word. Class definitions are automatically in strict mode.
!!! error TS1213: Identifier expected. 'protected' is a reserved word in strict mode. Class definitions are automatically in strict mode.
class public { }
~~~~~~
!!! error TS1213: Identifier expected. 'public' is a reserved word. Class definitions are automatically in strict mode.
!!! error TS1213: Identifier expected. 'public' is a reserved word in strict mode. Class definitions are automatically in strict mode.
class set { }
class static { }
~~~~~~
!!! error TS1213: Identifier expected. 'static' is a reserved word. Class definitions are automatically in strict mode.
!!! error TS1213: Identifier expected. 'static' is a reserved word in strict mode. Class definitions are automatically in strict mode.
class get { }
class yield { }
~~~~~
!!! error TS1213: Identifier expected. 'yield' is a reserved word. Class definitions are automatically in strict mode.
!!! error TS1213: Identifier expected. 'yield' is a reserved word in strict mode. Class definitions are automatically in strict mode.
class declare { }
}

View File

@ -1,4 +1,4 @@
tests/cases/conformance/parser/ecmascript5/RegressionTests/parser553699.ts(3,21): error TS1216: Type expected. 'public' is a reserved word. Class definitions are automatically in strict mode.
tests/cases/conformance/parser/ecmascript5/RegressionTests/parser553699.ts(3,21): error TS1216: Type expected. 'public' is a reserved word in strict mode. Class definitions are automatically in strict mode.
tests/cases/conformance/parser/ecmascript5/RegressionTests/parser553699.ts(3,21): error TS2304: Cannot find name 'public'.
@ -7,7 +7,7 @@ tests/cases/conformance/parser/ecmascript5/RegressionTests/parser553699.ts(3,21)
constructor() { }
public banana (x: public) { }
~~~~~~
!!! error TS1216: Type expected. 'public' is a reserved word. Class definitions are automatically in strict mode.
!!! error TS1216: Type expected. 'public' is a reserved word in strict mode. Class definitions are automatically in strict mode.
~~~~~~
!!! error TS2304: Cannot find name 'public'.
}

View File

@ -1,10 +1,10 @@
tests/cases/conformance/parser/ecmascript5/RegressionTests/parser642331.ts(2,18): error TS1213: Identifier expected. 'static' is a reserved word. Class definitions are automatically in strict mode.
tests/cases/conformance/parser/ecmascript5/RegressionTests/parser642331.ts(2,18): error TS1213: Identifier expected. 'static' is a reserved word in strict mode. Class definitions are automatically in strict mode.
==== tests/cases/conformance/parser/ecmascript5/RegressionTests/parser642331.ts (1 errors) ====
class test {
constructor (static) { }
~~~~~~
!!! error TS1213: Identifier expected. 'static' is a reserved word. Class definitions are automatically in strict mode.
!!! error TS1213: Identifier expected. 'static' is a reserved word in strict mode. Class definitions are automatically in strict mode.
}

View File

@ -1,4 +1,4 @@
tests/cases/conformance/parser/ecmascript5/RegressionTests/parser642331_1.ts(4,18): error TS1213: Identifier expected. 'static' is a reserved word. Class definitions are automatically in strict mode.
tests/cases/conformance/parser/ecmascript5/RegressionTests/parser642331_1.ts(4,18): error TS1213: Identifier expected. 'static' is a reserved word in strict mode. Class definitions are automatically in strict mode.
==== tests/cases/conformance/parser/ecmascript5/RegressionTests/parser642331_1.ts (1 errors) ====
@ -7,6 +7,6 @@ tests/cases/conformance/parser/ecmascript5/RegressionTests/parser642331_1.ts(4,1
class test {
constructor (static) { }
~~~~~~
!!! error TS1213: Identifier expected. 'static' is a reserved word. Class definitions are automatically in strict mode.
!!! error TS1213: Identifier expected. 'static' is a reserved word in strict mode. Class definitions are automatically in strict mode.
}

View File

@ -1,18 +1,18 @@
tests/cases/compiler/strictModeCode1.ts(4,17): error TS1213: Identifier expected. 'private' is a reserved word. Class definitions are automatically in strict mode.
tests/cases/compiler/strictModeCode1.ts(4,26): error TS1213: Identifier expected. 'public' is a reserved word. Class definitions are automatically in strict mode.
tests/cases/compiler/strictModeCode1.ts(4,34): error TS1213: Identifier expected. 'static' is a reserved word. Class definitions are automatically in strict mode.
tests/cases/compiler/strictModeCode1.ts(4,17): error TS1213: Identifier expected. 'private' is a reserved word in strict mode. Class definitions are automatically in strict mode.
tests/cases/compiler/strictModeCode1.ts(4,26): error TS1213: Identifier expected. 'public' is a reserved word in strict mode. Class definitions are automatically in strict mode.
tests/cases/compiler/strictModeCode1.ts(4,34): error TS1213: Identifier expected. 'static' is a reserved word in strict mode. Class definitions are automatically in strict mode.
tests/cases/compiler/strictModeCode1.ts(5,9): error TS1212: Identifier expected. 'private' is a reserved word in strict mode
tests/cases/compiler/strictModeCode1.ts(5,19): error TS1212: Identifier expected. 'public' is a reserved word in strict mode
tests/cases/compiler/strictModeCode1.ts(5,28): error TS1212: Identifier expected. 'static' is a reserved word in strict mode
tests/cases/compiler/strictModeCode1.ts(7,22): error TS1216: Type expected. 'public' is a reserved word. Class definitions are automatically in strict mode.
tests/cases/compiler/strictModeCode1.ts(11,24): error TS1213: Identifier expected. 'public' is a reserved word. Class definitions are automatically in strict mode.
tests/cases/compiler/strictModeCode1.ts(11,32): error TS1213: Identifier expected. 'let' is a reserved word. Class definitions are automatically in strict mode.
tests/cases/compiler/strictModeCode1.ts(13,10): error TS1213: Identifier expected. 'private' is a reserved word. Class definitions are automatically in strict mode.
tests/cases/compiler/strictModeCode1.ts(13,19): error TS1213: Identifier expected. 'static' is a reserved word. Class definitions are automatically in strict mode.
tests/cases/compiler/strictModeCode1.ts(13,27): error TS1213: Identifier expected. 'public' is a reserved word. Class definitions are automatically in strict mode.
tests/cases/compiler/strictModeCode1.ts(14,18): error TS1213: Identifier expected. 'let' is a reserved word. Class definitions are automatically in strict mode.
tests/cases/compiler/strictModeCode1.ts(20,9): error TS1213: Identifier expected. 'public' is a reserved word. Class definitions are automatically in strict mode.
tests/cases/compiler/strictModeCode1.ts(20,17): error TS1213: Identifier expected. 'private' is a reserved word. Class definitions are automatically in strict mode.
tests/cases/compiler/strictModeCode1.ts(7,22): error TS1216: Type expected. 'public' is a reserved word in strict mode. Class definitions are automatically in strict mode.
tests/cases/compiler/strictModeCode1.ts(11,24): error TS1213: Identifier expected. 'public' is a reserved word in strict mode. Class definitions are automatically in strict mode.
tests/cases/compiler/strictModeCode1.ts(11,32): error TS1213: Identifier expected. 'let' is a reserved word in strict mode. Class definitions are automatically in strict mode.
tests/cases/compiler/strictModeCode1.ts(13,10): error TS1213: Identifier expected. 'private' is a reserved word in strict mode. Class definitions are automatically in strict mode.
tests/cases/compiler/strictModeCode1.ts(13,19): error TS1213: Identifier expected. 'static' is a reserved word in strict mode. Class definitions are automatically in strict mode.
tests/cases/compiler/strictModeCode1.ts(13,27): error TS1213: Identifier expected. 'public' is a reserved word in strict mode. Class definitions are automatically in strict mode.
tests/cases/compiler/strictModeCode1.ts(14,18): error TS1213: Identifier expected. 'let' is a reserved word in strict mode. Class definitions are automatically in strict mode.
tests/cases/compiler/strictModeCode1.ts(20,9): error TS1213: Identifier expected. 'public' is a reserved word in strict mode. Class definitions are automatically in strict mode.
tests/cases/compiler/strictModeCode1.ts(20,17): error TS1213: Identifier expected. 'private' is a reserved word in strict mode. Class definitions are automatically in strict mode.
tests/cases/compiler/strictModeCode1.ts(22,20): error TS1212: Identifier expected. 'public' is a reserved word in strict mode
@ -22,11 +22,11 @@ tests/cases/compiler/strictModeCode1.ts(22,20): error TS1212: Identifier expecte
class Foo {
constructor(private, public, static) {
~~~~~~~
!!! error TS1213: Identifier expected. 'private' is a reserved word. Class definitions are automatically in strict mode.
!!! error TS1213: Identifier expected. 'private' is a reserved word in strict mode. Class definitions are automatically in strict mode.
~~~~~~
!!! error TS1213: Identifier expected. 'public' is a reserved word. Class definitions are automatically in strict mode.
!!! error TS1213: Identifier expected. 'public' is a reserved word in strict mode. Class definitions are automatically in strict mode.
~~~~~~
!!! error TS1213: Identifier expected. 'static' is a reserved word. Class definitions are automatically in strict mode.
!!! error TS1213: Identifier expected. 'static' is a reserved word in strict mode. Class definitions are automatically in strict mode.
private = public = static;
~~~~~~~
!!! error TS1212: Identifier expected. 'private' is a reserved word in strict mode
@ -37,26 +37,26 @@ tests/cases/compiler/strictModeCode1.ts(22,20): error TS1212: Identifier expecte
}
public banana(x: public) { }
~~~~~~
!!! error TS1216: Type expected. 'public' is a reserved word. Class definitions are automatically in strict mode.
!!! error TS1216: Type expected. 'public' is a reserved word in strict mode. Class definitions are automatically in strict mode.
}
class C {
constructor(public public, let) {
~~~~~~
!!! error TS1213: Identifier expected. 'public' is a reserved word. Class definitions are automatically in strict mode.
!!! error TS1213: Identifier expected. 'public' is a reserved word in strict mode. Class definitions are automatically in strict mode.
~~~
!!! error TS1213: Identifier expected. 'let' is a reserved word. Class definitions are automatically in strict mode.
!!! error TS1213: Identifier expected. 'let' is a reserved word in strict mode. Class definitions are automatically in strict mode.
}
foo1(private, static, public) {
~~~~~~~
!!! error TS1213: Identifier expected. 'private' is a reserved word. Class definitions are automatically in strict mode.
!!! error TS1213: Identifier expected. 'private' is a reserved word in strict mode. Class definitions are automatically in strict mode.
~~~~~~
!!! error TS1213: Identifier expected. 'static' is a reserved word. Class definitions are automatically in strict mode.
!!! error TS1213: Identifier expected. 'static' is a reserved word in strict mode. Class definitions are automatically in strict mode.
~~~~~~
!!! error TS1213: Identifier expected. 'public' is a reserved word. Class definitions are automatically in strict mode.
!!! error TS1213: Identifier expected. 'public' is a reserved word in strict mode. Class definitions are automatically in strict mode.
function let() { }
~~~
!!! error TS1213: Identifier expected. 'let' is a reserved word. Class definitions are automatically in strict mode.
!!! error TS1213: Identifier expected. 'let' is a reserved word in strict mode. Class definitions are automatically in strict mode.
var z = function let() { };
}
@ -64,9 +64,9 @@ tests/cases/compiler/strictModeCode1.ts(22,20): error TS1212: Identifier expecte
class D<public, private>{ }
~~~~~~
!!! error TS1213: Identifier expected. 'public' is a reserved word. Class definitions are automatically in strict mode.
!!! error TS1213: Identifier expected. 'public' is a reserved word in strict mode. Class definitions are automatically in strict mode.
~~~~~~~
!!! error TS1213: Identifier expected. 'private' is a reserved word. Class definitions are automatically in strict mode.
!!! error TS1213: Identifier expected. 'private' is a reserved word in strict mode. Class definitions are automatically in strict mode.
class E implements public { }
~~~~~~

View File

@ -3,9 +3,11 @@ tests/cases/compiler/strictModeCode5.ts(3,10): error TS1212: Identifier expected
tests/cases/compiler/strictModeCode5.ts(4,7): error TS1212: Identifier expected. 'private' is a reserved word in strict mode
tests/cases/compiler/strictModeCode5.ts(5,15): error TS1212: Identifier expected. 'static' is a reserved word in strict mode
tests/cases/compiler/strictModeCode5.ts(5,38): error TS1212: Identifier expected. 'package' is a reserved word in strict mode
tests/cases/compiler/strictModeCode5.ts(6,6): error TS1212: Identifier expected. 'public' is a reserved word in strict mode
tests/cases/compiler/strictModeCode5.ts(6,14): error TS1212: Identifier expected. 'protected' is a reserved word in strict mode
==== tests/cases/compiler/strictModeCode5.ts (5 errors) ====
==== tests/cases/compiler/strictModeCode5.ts (7 errors) ====
"use strict"
var [public] = [1];
~~~~~~
@ -20,4 +22,9 @@ tests/cases/compiler/strictModeCode5.ts(5,38): error TS1212: Identifier expected
~~~~~~
!!! error TS1212: Identifier expected. 'static' is a reserved word in strict mode
~~~~~~~
!!! error TS1212: Identifier expected. 'package' is a reserved word in strict mode
!!! error TS1212: Identifier expected. 'package' is a reserved word in strict mode
var {public, protected} = { public: 1, protected: 2 };
~~~~~~
!!! error TS1212: Identifier expected. 'public' is a reserved word in strict mode
~~~~~~~~~
!!! error TS1212: Identifier expected. 'protected' is a reserved word in strict mode

View File

@ -3,7 +3,8 @@
var [public] = [1];
var { x: public } = { x: 1 };
var [[private]] = [["hello"]];
var { y: { s: static }, z: { o: { p: package} }} = { y: { s: 1 }, z: { o: { p: 'h' } } };
var { y: { s: static }, z: { o: { p: package} }} = { y: { s: 1 }, z: { o: { p: 'h' } } };
var {public, protected} = { public: 1, protected: 2 };
//// [strictModeCode5.js]
"use strict";
@ -11,3 +12,4 @@ var public = ([1])[0];
var public = ({ x: 1 }).x;
var private = ([["hello"]])[0][0];
var _a = { y: { s: 1 }, z: { o: { p: 'h' } } }, static = _a.y.s, package = _a.z.o.p;
var _b = { public: 1, protected: 2 }, public = _b.public, protected = _b.protected;

View File

@ -1,12 +1,24 @@
tests/cases/compiler/strictModeCode8.ts(2,8): error TS1214: Identifier expected. 'public' is a reserved word. Module is automatically in strict mode.
tests/cases/compiler/strictModeCode8.ts(3,8): error TS1214: Identifier expected. 'private' is a reserved word. Module is automatically in strict mode.
tests/cases/compiler/strictModeCode8.ts(2,8): error TS1212: Identifier expected. 'public' is a reserved word in strict mode
tests/cases/compiler/strictModeCode8.ts(3,8): error TS1212: Identifier expected. 'private' is a reserved word in strict mode
tests/cases/compiler/strictModeCode8.ts(4,8): error TS1212: Identifier expected. 'public' is a reserved word in strict mode
tests/cases/compiler/strictModeCode8.ts(6,8): error TS1212: Identifier expected. 'private' is a reserved word in strict mode
tests/cases/compiler/strictModeCode8.ts(6,16): error TS1212: Identifier expected. 'public' is a reserved word in strict mode
==== tests/cases/compiler/strictModeCode8.ts (2 errors) ====
==== tests/cases/compiler/strictModeCode8.ts (5 errors) ====
"use strict"
module public { }
~~~~~~
!!! error TS1214: Identifier expected. 'public' is a reserved word. Module is automatically in strict mode.
!!! error TS1212: Identifier expected. 'public' is a reserved word in strict mode
module private { }
~~~~~~~
!!! error TS1214: Identifier expected. 'private' is a reserved word. Module is automatically in strict mode.
!!! error TS1212: Identifier expected. 'private' is a reserved word in strict mode
module public.whatever {
~~~~~~
!!! error TS1212: Identifier expected. 'public' is a reserved word in strict mode
}
module private.public.foo { }
~~~~~~~
!!! error TS1212: Identifier expected. 'private' is a reserved word in strict mode
~~~~~~
!!! error TS1212: Identifier expected. 'public' is a reserved word in strict mode

View File

@ -1,7 +1,10 @@
//// [strictModeCode8.ts]
"use strict"
module public { }
module private { }
module private { }
module public.whatever {
}
module private.public.foo { }
//// [strictModeCode8.js]
"use strict";

View File

@ -2,4 +2,5 @@
var [public] = [1];
var { x: public } = { x: 1 };
var [[private]] = [["hello"]];
var { y: { s: static }, z: { o: { p: package} }} = { y: { s: 1 }, z: { o: { p: 'h' } } };
var { y: { s: static }, z: { o: { p: package} }} = { y: { s: 1 }, z: { o: { p: 'h' } } };
var {public, protected} = { public: 1, protected: 2 };

View File

@ -1,3 +1,6 @@
"use strict"
module public { }
module private { }
module private { }
module public.whatever {
}
module private.public.foo { }