Merge branch 'release-1.5' into filterTranspileDiagnostics

This commit is contained in:
Mohamed Hegazy 2015-06-02 18:01:05 -07:00
commit c83054cd4b
78 changed files with 492 additions and 60 deletions

View File

@ -1092,6 +1092,7 @@ var ts;
Type_expected_0_is_a_reserved_word_in_strict_mode: { code: 1215, category: ts.DiagnosticCategory.Error, key: "Type expected. '{0}' is a reserved word in strict mode" },
Type_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_strict_mode: { code: 1216, category: ts.DiagnosticCategory.Error, key: "Type expected. '{0}' is a reserved word in strict mode. Class definitions are automatically in strict mode." },
Export_assignment_is_not_supported_when_module_flag_is_system: { code: 1218, category: ts.DiagnosticCategory.Error, key: "Export assignment is not supported when '--module' flag is 'system'." },
Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Specify_experimentalDecorators_to_remove_this_warning: { code: 1219, category: ts.DiagnosticCategory.Error, key: "Experimental support for decorators is a feature that is subject to change in a future release. Specify '--experimentalDecorators' to remove this warning." },
Duplicate_identifier_0: { code: 2300, category: ts.DiagnosticCategory.Error, key: "Duplicate identifier '{0}'." },
Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: ts.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: ts.DiagnosticCategory.Error, key: "Static members cannot reference class type parameters." },
@ -1425,6 +1426,9 @@ var ts;
Specifies_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix: { code: 6060, category: ts.DiagnosticCategory.Message, key: "Specifies the end of line sequence to be used when emitting files: 'CRLF' (dos) or 'LF' (unix)." },
NEWLINE: { code: 6061, category: ts.DiagnosticCategory.Message, key: "NEWLINE" },
Argument_for_newLine_option_must_be_CRLF_or_LF: { code: 6062, category: ts.DiagnosticCategory.Error, key: "Argument for '--newLine' option must be 'CRLF' or 'LF'." },
Option_experimentalDecorators_must_also_be_specified_when_option_emitDecoratorMetadata_is_specified: { code: 6064, category: ts.DiagnosticCategory.Error, key: "Option 'experimentalDecorators' must also be specified when option 'emitDecoratorMetadata' is specified." },
Enables_experimental_support_for_ES7_decorators: { code: 6065, category: ts.DiagnosticCategory.Message, key: "Enables experimental support for ES7 decorators." },
Enables_experimental_support_for_emitting_type_metadata_for_decorators: { code: 6066, category: ts.DiagnosticCategory.Message, key: "Enables experimental support for emitting type metadata for decorators." },
Variable_0_implicitly_has_an_1_type: { code: 7005, category: ts.DiagnosticCategory.Error, key: "Variable '{0}' implicitly has an '{1}' type." },
Parameter_0_implicitly_has_an_1_type: { code: 7006, category: ts.DiagnosticCategory.Error, key: "Parameter '{0}' implicitly has an '{1}' type." },
Member_0_implicitly_has_an_1_type: { code: 7008, category: ts.DiagnosticCategory.Error, key: "Member '{0}' implicitly has an '{1}' type." },
@ -8888,27 +8892,31 @@ var ts;
case 138:
case 201:
case 164:
if (name === "arguments") {
if (meaning & 3 && name === "arguments") {
result = argumentsSymbol;
break loop;
}
break;
case 163:
if (name === "arguments") {
if (meaning & 3 && name === "arguments") {
result = argumentsSymbol;
break loop;
}
var functionName = location.name;
if (functionName && name === functionName.text) {
result = location.symbol;
break loop;
if (meaning & 16) {
var functionName = location.name;
if (functionName && name === functionName.text) {
result = location.symbol;
break loop;
}
}
break;
case 175:
var className = location.name;
if (className && name === className.text) {
result = location.symbol;
break loop;
if (meaning & 32) {
var className = location.name;
if (className && name === className.text) {
result = location.symbol;
break loop;
}
}
break;
case 131:
@ -15586,6 +15594,9 @@ var ts;
if (!ts.nodeCanBeDecorated(node)) {
return;
}
if (!compilerOptions.experimentalDecorators) {
error(node, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Specify_experimentalDecorators_to_remove_this_warning);
}
if (compilerOptions.emitDecoratorMetadata) {
switch (node.kind) {
case 202:
@ -25547,6 +25558,10 @@ var ts;
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_noEmit_cannot_be_specified_with_option_declaration));
}
}
if (options.emitDecoratorMetadata &&
!options.experimentalDecorators) {
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_experimentalDecorators_must_also_be_specified_when_option_emitDecoratorMetadata_is_specified));
}
}
}
ts.createProgram = createProgram;
@ -25740,10 +25755,16 @@ var ts;
type: "boolean",
description: ts.Diagnostics.Watch_input_files
},
{
name: "experimentalDecorators",
type: "boolean",
description: ts.Diagnostics.Enables_experimental_support_for_ES7_decorators
},
{
name: "emitDecoratorMetadata",
type: "boolean",
experimental: true
experimental: true,
description: ts.Diagnostics.Enables_experimental_support_for_emitting_type_metadata_for_decorators
}
];
function parseCommandLine(commandLine) {

View File

@ -1092,6 +1092,7 @@ var ts;
Type_expected_0_is_a_reserved_word_in_strict_mode: { code: 1215, category: ts.DiagnosticCategory.Error, key: "Type expected. '{0}' is a reserved word in strict mode" },
Type_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_strict_mode: { code: 1216, category: ts.DiagnosticCategory.Error, key: "Type expected. '{0}' is a reserved word in strict mode. Class definitions are automatically in strict mode." },
Export_assignment_is_not_supported_when_module_flag_is_system: { code: 1218, category: ts.DiagnosticCategory.Error, key: "Export assignment is not supported when '--module' flag is 'system'." },
Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Specify_experimentalDecorators_to_remove_this_warning: { code: 1219, category: ts.DiagnosticCategory.Error, key: "Experimental support for decorators is a feature that is subject to change in a future release. Specify '--experimentalDecorators' to remove this warning." },
Duplicate_identifier_0: { code: 2300, category: ts.DiagnosticCategory.Error, key: "Duplicate identifier '{0}'." },
Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: ts.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: ts.DiagnosticCategory.Error, key: "Static members cannot reference class type parameters." },
@ -1425,6 +1426,9 @@ var ts;
Specifies_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix: { code: 6060, category: ts.DiagnosticCategory.Message, key: "Specifies the end of line sequence to be used when emitting files: 'CRLF' (dos) or 'LF' (unix)." },
NEWLINE: { code: 6061, category: ts.DiagnosticCategory.Message, key: "NEWLINE" },
Argument_for_newLine_option_must_be_CRLF_or_LF: { code: 6062, category: ts.DiagnosticCategory.Error, key: "Argument for '--newLine' option must be 'CRLF' or 'LF'." },
Option_experimentalDecorators_must_also_be_specified_when_option_emitDecoratorMetadata_is_specified: { code: 6064, category: ts.DiagnosticCategory.Error, key: "Option 'experimentalDecorators' must also be specified when option 'emitDecoratorMetadata' is specified." },
Enables_experimental_support_for_ES7_decorators: { code: 6065, category: ts.DiagnosticCategory.Message, key: "Enables experimental support for ES7 decorators." },
Enables_experimental_support_for_emitting_type_metadata_for_decorators: { code: 6066, category: ts.DiagnosticCategory.Message, key: "Enables experimental support for emitting type metadata for decorators." },
Variable_0_implicitly_has_an_1_type: { code: 7005, category: ts.DiagnosticCategory.Error, key: "Variable '{0}' implicitly has an '{1}' type." },
Parameter_0_implicitly_has_an_1_type: { code: 7006, category: ts.DiagnosticCategory.Error, key: "Parameter '{0}' implicitly has an '{1}' type." },
Member_0_implicitly_has_an_1_type: { code: 7008, category: ts.DiagnosticCategory.Error, key: "Member '{0}' implicitly has an '{1}' type." },
@ -2900,10 +2904,16 @@ var ts;
type: "boolean",
description: ts.Diagnostics.Watch_input_files
},
{
name: "experimentalDecorators",
type: "boolean",
description: ts.Diagnostics.Enables_experimental_support_for_ES7_decorators
},
{
name: "emitDecoratorMetadata",
type: "boolean",
experimental: true
experimental: true,
description: ts.Diagnostics.Enables_experimental_support_for_emitting_type_metadata_for_decorators
}
];
function parseCommandLine(commandLine) {
@ -9272,27 +9282,31 @@ var ts;
case 138:
case 201:
case 164:
if (name === "arguments") {
if (meaning & 3 && name === "arguments") {
result = argumentsSymbol;
break loop;
}
break;
case 163:
if (name === "arguments") {
if (meaning & 3 && name === "arguments") {
result = argumentsSymbol;
break loop;
}
var functionName = location.name;
if (functionName && name === functionName.text) {
result = location.symbol;
break loop;
if (meaning & 16) {
var functionName = location.name;
if (functionName && name === functionName.text) {
result = location.symbol;
break loop;
}
}
break;
case 175:
var className = location.name;
if (className && name === className.text) {
result = location.symbol;
break loop;
if (meaning & 32) {
var className = location.name;
if (className && name === className.text) {
result = location.symbol;
break loop;
}
}
break;
case 131:
@ -15970,6 +15984,9 @@ var ts;
if (!ts.nodeCanBeDecorated(node)) {
return;
}
if (!compilerOptions.experimentalDecorators) {
error(node, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Specify_experimentalDecorators_to_remove_this_warning);
}
if (compilerOptions.emitDecoratorMetadata) {
switch (node.kind) {
case 202:
@ -25931,6 +25948,10 @@ var ts;
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_noEmit_cannot_be_specified_with_option_declaration));
}
}
if (options.emitDecoratorMetadata &&
!options.experimentalDecorators) {
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_experimentalDecorators_must_also_be_specified_when_option_emitDecoratorMetadata_is_specified));
}
}
}
ts.createProgram = createProgram;

1
bin/typescript.d.ts vendored
View File

@ -1115,6 +1115,7 @@ declare module "typescript" {
version?: boolean;
watch?: boolean;
isolatedModules?: boolean;
experimentalDecorators?: boolean;
emitDecoratorMetadata?: boolean;
[option: string]: string | number | boolean;
}

View File

@ -1840,6 +1840,7 @@ var ts;
Type_expected_0_is_a_reserved_word_in_strict_mode: { code: 1215, category: ts.DiagnosticCategory.Error, key: "Type expected. '{0}' is a reserved word in strict mode" },
Type_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_strict_mode: { code: 1216, category: ts.DiagnosticCategory.Error, key: "Type expected. '{0}' is a reserved word in strict mode. Class definitions are automatically in strict mode." },
Export_assignment_is_not_supported_when_module_flag_is_system: { code: 1218, category: ts.DiagnosticCategory.Error, key: "Export assignment is not supported when '--module' flag is 'system'." },
Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Specify_experimentalDecorators_to_remove_this_warning: { code: 1219, category: ts.DiagnosticCategory.Error, key: "Experimental support for decorators is a feature that is subject to change in a future release. Specify '--experimentalDecorators' to remove this warning." },
Duplicate_identifier_0: { code: 2300, category: ts.DiagnosticCategory.Error, key: "Duplicate identifier '{0}'." },
Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: ts.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: ts.DiagnosticCategory.Error, key: "Static members cannot reference class type parameters." },
@ -2173,6 +2174,9 @@ var ts;
Specifies_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix: { code: 6060, category: ts.DiagnosticCategory.Message, key: "Specifies the end of line sequence to be used when emitting files: 'CRLF' (dos) or 'LF' (unix)." },
NEWLINE: { code: 6061, category: ts.DiagnosticCategory.Message, key: "NEWLINE" },
Argument_for_newLine_option_must_be_CRLF_or_LF: { code: 6062, category: ts.DiagnosticCategory.Error, key: "Argument for '--newLine' option must be 'CRLF' or 'LF'." },
Option_experimentalDecorators_must_also_be_specified_when_option_emitDecoratorMetadata_is_specified: { code: 6064, category: ts.DiagnosticCategory.Error, key: "Option 'experimentalDecorators' must also be specified when option 'emitDecoratorMetadata' is specified." },
Enables_experimental_support_for_ES7_decorators: { code: 6065, category: ts.DiagnosticCategory.Message, key: "Enables experimental support for ES7 decorators." },
Enables_experimental_support_for_emitting_type_metadata_for_decorators: { code: 6066, category: ts.DiagnosticCategory.Message, key: "Enables experimental support for emitting type metadata for decorators." },
Variable_0_implicitly_has_an_1_type: { code: 7005, category: ts.DiagnosticCategory.Error, key: "Variable '{0}' implicitly has an '{1}' type." },
Parameter_0_implicitly_has_an_1_type: { code: 7006, category: ts.DiagnosticCategory.Error, key: "Parameter '{0}' implicitly has an '{1}' type." },
Member_0_implicitly_has_an_1_type: { code: 7008, category: ts.DiagnosticCategory.Error, key: "Member '{0}' implicitly has an '{1}' type." },
@ -11143,27 +11147,31 @@ var ts;
case 138 /* SetAccessor */:
case 201 /* FunctionDeclaration */:
case 164 /* ArrowFunction */:
if (name === "arguments") {
if (meaning & 3 /* Variable */ && name === "arguments") {
result = argumentsSymbol;
break loop;
}
break;
case 163 /* FunctionExpression */:
if (name === "arguments") {
if (meaning & 3 /* Variable */ && name === "arguments") {
result = argumentsSymbol;
break loop;
}
var functionName = location.name;
if (functionName && name === functionName.text) {
result = location.symbol;
break loop;
if (meaning & 16 /* Function */) {
var functionName = location.name;
if (functionName && name === functionName.text) {
result = location.symbol;
break loop;
}
}
break;
case 175 /* ClassExpression */:
var className = location.name;
if (className && name === className.text) {
result = location.symbol;
break loop;
if (meaning & 32 /* Class */) {
var className = location.name;
if (className && name === className.text) {
result = location.symbol;
break loop;
}
}
break;
case 131 /* Decorator */:
@ -18932,6 +18940,9 @@ var ts;
if (!ts.nodeCanBeDecorated(node)) {
return;
}
if (!compilerOptions.experimentalDecorators) {
error(node, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Specify_experimentalDecorators_to_remove_this_warning);
}
if (compilerOptions.emitDecoratorMetadata) {
// we only need to perform these checks if we are emitting serialized type metadata for the target of a decorator.
switch (node.kind) {
@ -30183,6 +30194,10 @@ var ts;
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_noEmit_cannot_be_specified_with_option_declaration));
}
}
if (options.emitDecoratorMetadata &&
!options.experimentalDecorators) {
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_experimentalDecorators_must_also_be_specified_when_option_emitDecoratorMetadata_is_specified));
}
}
}
ts.createProgram = createProgram;
@ -30377,10 +30392,16 @@ var ts;
type: "boolean",
description: ts.Diagnostics.Watch_input_files
},
{
name: "experimentalDecorators",
type: "boolean",
description: ts.Diagnostics.Enables_experimental_support_for_ES7_decorators
},
{
name: "emitDecoratorMetadata",
type: "boolean",
experimental: true
experimental: true,
description: ts.Diagnostics.Enables_experimental_support_for_emitting_type_metadata_for_decorators
}
];
function parseCommandLine(commandLine) {

View File

@ -1115,6 +1115,7 @@ declare module ts {
version?: boolean;
watch?: boolean;
isolatedModules?: boolean;
experimentalDecorators?: boolean;
emitDecoratorMetadata?: boolean;
[option: string]: string | number | boolean;
}

View File

@ -1840,6 +1840,7 @@ var ts;
Type_expected_0_is_a_reserved_word_in_strict_mode: { code: 1215, category: ts.DiagnosticCategory.Error, key: "Type expected. '{0}' is a reserved word in strict mode" },
Type_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_strict_mode: { code: 1216, category: ts.DiagnosticCategory.Error, key: "Type expected. '{0}' is a reserved word in strict mode. Class definitions are automatically in strict mode." },
Export_assignment_is_not_supported_when_module_flag_is_system: { code: 1218, category: ts.DiagnosticCategory.Error, key: "Export assignment is not supported when '--module' flag is 'system'." },
Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Specify_experimentalDecorators_to_remove_this_warning: { code: 1219, category: ts.DiagnosticCategory.Error, key: "Experimental support for decorators is a feature that is subject to change in a future release. Specify '--experimentalDecorators' to remove this warning." },
Duplicate_identifier_0: { code: 2300, category: ts.DiagnosticCategory.Error, key: "Duplicate identifier '{0}'." },
Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: ts.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: ts.DiagnosticCategory.Error, key: "Static members cannot reference class type parameters." },
@ -2173,6 +2174,9 @@ var ts;
Specifies_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix: { code: 6060, category: ts.DiagnosticCategory.Message, key: "Specifies the end of line sequence to be used when emitting files: 'CRLF' (dos) or 'LF' (unix)." },
NEWLINE: { code: 6061, category: ts.DiagnosticCategory.Message, key: "NEWLINE" },
Argument_for_newLine_option_must_be_CRLF_or_LF: { code: 6062, category: ts.DiagnosticCategory.Error, key: "Argument for '--newLine' option must be 'CRLF' or 'LF'." },
Option_experimentalDecorators_must_also_be_specified_when_option_emitDecoratorMetadata_is_specified: { code: 6064, category: ts.DiagnosticCategory.Error, key: "Option 'experimentalDecorators' must also be specified when option 'emitDecoratorMetadata' is specified." },
Enables_experimental_support_for_ES7_decorators: { code: 6065, category: ts.DiagnosticCategory.Message, key: "Enables experimental support for ES7 decorators." },
Enables_experimental_support_for_emitting_type_metadata_for_decorators: { code: 6066, category: ts.DiagnosticCategory.Message, key: "Enables experimental support for emitting type metadata for decorators." },
Variable_0_implicitly_has_an_1_type: { code: 7005, category: ts.DiagnosticCategory.Error, key: "Variable '{0}' implicitly has an '{1}' type." },
Parameter_0_implicitly_has_an_1_type: { code: 7006, category: ts.DiagnosticCategory.Error, key: "Parameter '{0}' implicitly has an '{1}' type." },
Member_0_implicitly_has_an_1_type: { code: 7008, category: ts.DiagnosticCategory.Error, key: "Member '{0}' implicitly has an '{1}' type." },
@ -11143,27 +11147,31 @@ var ts;
case 138 /* SetAccessor */:
case 201 /* FunctionDeclaration */:
case 164 /* ArrowFunction */:
if (name === "arguments") {
if (meaning & 3 /* Variable */ && name === "arguments") {
result = argumentsSymbol;
break loop;
}
break;
case 163 /* FunctionExpression */:
if (name === "arguments") {
if (meaning & 3 /* Variable */ && name === "arguments") {
result = argumentsSymbol;
break loop;
}
var functionName = location.name;
if (functionName && name === functionName.text) {
result = location.symbol;
break loop;
if (meaning & 16 /* Function */) {
var functionName = location.name;
if (functionName && name === functionName.text) {
result = location.symbol;
break loop;
}
}
break;
case 175 /* ClassExpression */:
var className = location.name;
if (className && name === className.text) {
result = location.symbol;
break loop;
if (meaning & 32 /* Class */) {
var className = location.name;
if (className && name === className.text) {
result = location.symbol;
break loop;
}
}
break;
case 131 /* Decorator */:
@ -18932,6 +18940,9 @@ var ts;
if (!ts.nodeCanBeDecorated(node)) {
return;
}
if (!compilerOptions.experimentalDecorators) {
error(node, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Specify_experimentalDecorators_to_remove_this_warning);
}
if (compilerOptions.emitDecoratorMetadata) {
// we only need to perform these checks if we are emitting serialized type metadata for the target of a decorator.
switch (node.kind) {
@ -30183,6 +30194,10 @@ var ts;
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_noEmit_cannot_be_specified_with_option_declaration));
}
}
if (options.emitDecoratorMetadata &&
!options.experimentalDecorators) {
diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_experimentalDecorators_must_also_be_specified_when_option_emitDecoratorMetadata_is_specified));
}
}
}
ts.createProgram = createProgram;
@ -30377,10 +30392,16 @@ var ts;
type: "boolean",
description: ts.Diagnostics.Watch_input_files
},
{
name: "experimentalDecorators",
type: "boolean",
description: ts.Diagnostics.Enables_experimental_support_for_ES7_decorators
},
{
name: "emitDecoratorMetadata",
type: "boolean",
experimental: true
experimental: true,
description: ts.Diagnostics.Enables_experimental_support_for_emitting_type_metadata_for_decorators
}
];
function parseCommandLine(commandLine) {

View File

@ -422,27 +422,32 @@ module ts {
case SyntaxKind.SetAccessor:
case SyntaxKind.FunctionDeclaration:
case SyntaxKind.ArrowFunction:
if (name === "arguments") {
if (meaning & SymbolFlags.Variable && name === "arguments") {
result = argumentsSymbol;
break loop;
}
break;
case SyntaxKind.FunctionExpression:
if (name === "arguments") {
if (meaning & SymbolFlags.Variable && name === "arguments") {
result = argumentsSymbol;
break loop;
}
let functionName = (<FunctionExpression>location).name;
if (functionName && name === functionName.text) {
result = location.symbol;
break loop;
if (meaning & SymbolFlags.Function) {
let functionName = (<FunctionExpression>location).name;
if (functionName && name === functionName.text) {
result = location.symbol;
break loop;
}
}
break;
case SyntaxKind.ClassExpression:
let className = (<ClassExpression>location).name;
if (className && name === className.text) {
result = location.symbol;
break loop;
if (meaning & SymbolFlags.Class) {
let className = (<ClassExpression>location).name;
if (className && name === className.text) {
result = location.symbol;
break loop;
}
}
break;
case SyntaxKind.Decorator:
@ -8942,6 +8947,10 @@ module ts {
if (!nodeCanBeDecorated(node)) {
return;
}
if (!compilerOptions.experimentalDecorators) {
error(node, Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Specify_experimentalDecorators_to_remove_this_warning);
}
if (compilerOptions.emitDecoratorMetadata) {
// we only need to perform these checks if we are emitting serialized type metadata for the target of a decorator.

View File

@ -188,10 +188,16 @@ module ts {
type: "boolean",
description: Diagnostics.Watch_input_files,
},
{
name: "experimentalDecorators",
type: "boolean",
description: Diagnostics.Enables_experimental_support_for_ES7_decorators
},
{
name: "emitDecoratorMetadata",
type: "boolean",
experimental: true
experimental: true,
description: Diagnostics.Enables_experimental_support_for_emitting_type_metadata_for_decorators
}
];

View File

@ -174,6 +174,7 @@ module ts {
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_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." },
Export_assignment_is_not_supported_when_module_flag_is_system: { code: 1218, category: DiagnosticCategory.Error, key: "Export assignment is not supported when '--module' flag is 'system'." },
Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Specify_experimentalDecorators_to_remove_this_warning: { code: 1219, category: DiagnosticCategory.Error, key: "Experimental support for decorators is a feature that is subject to change in a future release. Specify '--experimentalDecorators' to remove this warning." },
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." },
@ -507,6 +508,9 @@ module ts {
Specifies_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix: { code: 6060, category: DiagnosticCategory.Message, key: "Specifies the end of line sequence to be used when emitting files: 'CRLF' (dos) or 'LF' (unix)." },
NEWLINE: { code: 6061, category: DiagnosticCategory.Message, key: "NEWLINE" },
Argument_for_newLine_option_must_be_CRLF_or_LF: { code: 6062, category: DiagnosticCategory.Error, key: "Argument for '--newLine' option must be 'CRLF' or 'LF'." },
Option_experimentalDecorators_must_also_be_specified_when_option_emitDecoratorMetadata_is_specified: { code: 6064, category: DiagnosticCategory.Error, key: "Option 'experimentalDecorators' must also be specified when option 'emitDecoratorMetadata' is specified." },
Enables_experimental_support_for_ES7_decorators: { code: 6065, category: DiagnosticCategory.Message, key: "Enables experimental support for ES7 decorators." },
Enables_experimental_support_for_emitting_type_metadata_for_decorators: { code: 6066, category: DiagnosticCategory.Message, key: "Enables experimental support for emitting type metadata for decorators." },
Variable_0_implicitly_has_an_1_type: { code: 7005, category: DiagnosticCategory.Error, key: "Variable '{0}' implicitly has an '{1}' type." },
Parameter_0_implicitly_has_an_1_type: { code: 7006, category: DiagnosticCategory.Error, key: "Parameter '{0}' implicitly has an '{1}' type." },
Member_0_implicitly_has_an_1_type: { code: 7008, category: DiagnosticCategory.Error, key: "Member '{0}' implicitly has an '{1}' type." },

View File

@ -683,6 +683,10 @@
"category": "Error",
"code": 1218
},
"Experimental support for decorators is a feature that is subject to change in a future release. Specify '--experimentalDecorators' to remove this warning.": {
"category": "Error",
"code": 1219
},
"Duplicate identifier '{0}'.": {
"category": "Error",
@ -2018,7 +2022,18 @@
"category": "Error",
"code": 6062
},
"Option 'experimentalDecorators' must also be specified when option 'emitDecoratorMetadata' is specified.": {
"category": "Error",
"code": 6064
},
"Enables experimental support for ES7 decorators.": {
"category": "Message",
"code": 6065
},
"Enables experimental support for emitting type metadata for decorators.": {
"category": "Message",
"code": 6066
},
"Variable '{0}' implicitly has an '{1}' type.": {
"category": "Error",

View File

@ -636,6 +636,11 @@ module ts {
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_noEmit_cannot_be_specified_with_option_declaration));
}
}
if (options.emitDecoratorMetadata &&
!options.experimentalDecorators) {
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_experimentalDecorators_must_also_be_specified_when_option_emitDecoratorMetadata_is_specified));
}
}
}
}

View File

@ -1678,6 +1678,7 @@ module ts {
version?: boolean;
watch?: boolean;
isolatedModules?: boolean;
experimentalDecorators?: boolean;
emitDecoratorMetadata?: boolean;
/* @internal */ stripInternal?: boolean;
[option: string]: string | number | boolean;

View File

@ -998,6 +998,10 @@ module Harness {
options.target = <any>setting.value;
}
break;
case 'experimentaldecorators':
options.experimentalDecorators = setting.value === 'true';
break;
case 'emitdecoratormetadata':
options.emitDecoratorMetadata = setting.value === 'true';
@ -1510,7 +1514,7 @@ module Harness {
"errortruncation", "usecasesensitivefilenames", "preserveconstenums",
"includebuiltfile", "suppressimplicitanyindexerrors", "stripinternal",
"isolatedmodules", "inlinesourcemap", "maproot", "sourceroot",
"inlinesources", "emitdecoratormetadata"];
"inlinesources", "emitdecoratormetadata", "experimentaldecorators"];
function extractCompilerSettings(content: string): CompilerSetting[] {

View File

@ -0,0 +1,14 @@
tests/cases/compiler/classExpressionWithResolutionOfNamespaceOfSameName01.ts(6,15): error TS9003: 'class' expressions are not currently supported.
==== tests/cases/compiler/classExpressionWithResolutionOfNamespaceOfSameName01.ts (1 errors) ====
namespace C {
export interface type {
}
}
var x = class C {
~
!!! error TS9003: 'class' expressions are not currently supported.
prop: C.type;
}

View File

@ -0,0 +1,16 @@
//// [classExpressionWithResolutionOfNamespaceOfSameName01.ts]
namespace C {
export interface type {
}
}
var x = class C {
prop: C.type;
}
//// [classExpressionWithResolutionOfNamespaceOfSameName01.js]
var x = (function () {
function C() {
}
return C;
})();

View File

@ -0,0 +1,12 @@
//// [functionDeclarationWithResolutionOfTypeNamedArguments01.ts]
interface arguments {
}
function f() {
<arguments>arguments;
}
//// [functionDeclarationWithResolutionOfTypeNamedArguments01.js]
function f() {
arguments;
}

View File

@ -0,0 +1,12 @@
=== tests/cases/compiler/functionDeclarationWithResolutionOfTypeNamedArguments01.ts ===
interface arguments {
>arguments : Symbol(arguments, Decl(functionDeclarationWithResolutionOfTypeNamedArguments01.ts, 0, 0))
}
function f() {
>f : Symbol(f, Decl(functionDeclarationWithResolutionOfTypeNamedArguments01.ts, 1, 1))
<arguments>arguments;
>arguments : Symbol(arguments, Decl(functionDeclarationWithResolutionOfTypeNamedArguments01.ts, 0, 0))
>arguments : Symbol(arguments)
}

View File

@ -0,0 +1,13 @@
=== tests/cases/compiler/functionDeclarationWithResolutionOfTypeNamedArguments01.ts ===
interface arguments {
>arguments : arguments
}
function f() {
>f : () => void
<arguments>arguments;
><arguments>arguments : arguments
>arguments : arguments
>arguments : IArguments
}

View File

@ -0,0 +1,12 @@
//// [functionDeclarationWithResolutionOfTypeOfSameName01.ts]
interface f {
}
function f() {
<f>f;
}
//// [functionDeclarationWithResolutionOfTypeOfSameName01.js]
function f() {
f;
}

View File

@ -0,0 +1,12 @@
=== tests/cases/compiler/functionDeclarationWithResolutionOfTypeOfSameName01.ts ===
interface f {
>f : Symbol(f, Decl(functionDeclarationWithResolutionOfTypeOfSameName01.ts, 0, 0), Decl(functionDeclarationWithResolutionOfTypeOfSameName01.ts, 1, 1))
}
function f() {
>f : Symbol(f, Decl(functionDeclarationWithResolutionOfTypeOfSameName01.ts, 0, 0), Decl(functionDeclarationWithResolutionOfTypeOfSameName01.ts, 1, 1))
<f>f;
>f : Symbol(f, Decl(functionDeclarationWithResolutionOfTypeOfSameName01.ts, 0, 0), Decl(functionDeclarationWithResolutionOfTypeOfSameName01.ts, 1, 1))
>f : Symbol(f, Decl(functionDeclarationWithResolutionOfTypeOfSameName01.ts, 0, 0), Decl(functionDeclarationWithResolutionOfTypeOfSameName01.ts, 1, 1))
}

View File

@ -0,0 +1,13 @@
=== tests/cases/compiler/functionDeclarationWithResolutionOfTypeOfSameName01.ts ===
interface f {
>f : f
}
function f() {
>f : () => void
<f>f;
><f>f : f
>f : f
>f : () => void
}

View File

@ -0,0 +1,12 @@
//// [functionExpressionWithResolutionOfTypeNamedArguments01.ts]
interface arguments {
}
var x = function f() {
<arguments>arguments;
}
//// [functionExpressionWithResolutionOfTypeNamedArguments01.js]
var x = function f() {
arguments;
};

View File

@ -0,0 +1,13 @@
=== tests/cases/compiler/functionExpressionWithResolutionOfTypeNamedArguments01.ts ===
interface arguments {
>arguments : Symbol(arguments, Decl(functionExpressionWithResolutionOfTypeNamedArguments01.ts, 0, 0))
}
var x = function f() {
>x : Symbol(x, Decl(functionExpressionWithResolutionOfTypeNamedArguments01.ts, 3, 3))
>f : Symbol(f, Decl(functionExpressionWithResolutionOfTypeNamedArguments01.ts, 3, 7))
<arguments>arguments;
>arguments : Symbol(arguments, Decl(functionExpressionWithResolutionOfTypeNamedArguments01.ts, 0, 0))
>arguments : Symbol(arguments)
}

View File

@ -0,0 +1,15 @@
=== tests/cases/compiler/functionExpressionWithResolutionOfTypeNamedArguments01.ts ===
interface arguments {
>arguments : arguments
}
var x = function f() {
>x : () => void
>function f() { <arguments>arguments;} : () => void
>f : () => void
<arguments>arguments;
><arguments>arguments : arguments
>arguments : arguments
>arguments : IArguments
}

View File

@ -0,0 +1,12 @@
//// [functionExpressionWithResolutionOfTypeOfSameName01.ts]
interface f {
}
var x = function f() {
<f>f;
}
//// [functionExpressionWithResolutionOfTypeOfSameName01.js]
var x = function f() {
f;
};

View File

@ -0,0 +1,13 @@
=== tests/cases/compiler/functionExpressionWithResolutionOfTypeOfSameName01.ts ===
interface f {
>f : Symbol(f, Decl(functionExpressionWithResolutionOfTypeOfSameName01.ts, 0, 0))
}
var x = function f() {
>x : Symbol(x, Decl(functionExpressionWithResolutionOfTypeOfSameName01.ts, 3, 3))
>f : Symbol(f, Decl(functionExpressionWithResolutionOfTypeOfSameName01.ts, 3, 7))
<f>f;
>f : Symbol(f, Decl(functionExpressionWithResolutionOfTypeOfSameName01.ts, 0, 0))
>f : Symbol(f, Decl(functionExpressionWithResolutionOfTypeOfSameName01.ts, 3, 7))
}

View File

@ -0,0 +1,15 @@
=== tests/cases/compiler/functionExpressionWithResolutionOfTypeOfSameName01.ts ===
interface f {
>f : f
}
var x = function f() {
>x : () => void
>function f() { <f>f;} : () => void
>f : () => void
<f>f;
><f>f : f
>f : f
>f : () => void
}

View File

@ -0,0 +1,12 @@
//// [functionExpressionWithResolutionOfTypeOfSameName02.ts]
interface Foo {
}
var x = function Foo() {
var x: Foo;
}
//// [functionExpressionWithResolutionOfTypeOfSameName02.js]
var x = function Foo() {
var x;
};

View File

@ -0,0 +1,13 @@
=== tests/cases/compiler/functionExpressionWithResolutionOfTypeOfSameName02.ts ===
interface Foo {
>Foo : Symbol(Foo, Decl(functionExpressionWithResolutionOfTypeOfSameName02.ts, 0, 0))
}
var x = function Foo() {
>x : Symbol(x, Decl(functionExpressionWithResolutionOfTypeOfSameName02.ts, 3, 3))
>Foo : Symbol(Foo, Decl(functionExpressionWithResolutionOfTypeOfSameName02.ts, 3, 7))
var x: Foo;
>x : Symbol(x, Decl(functionExpressionWithResolutionOfTypeOfSameName02.ts, 4, 7))
>Foo : Symbol(Foo, Decl(functionExpressionWithResolutionOfTypeOfSameName02.ts, 0, 0))
}

View File

@ -0,0 +1,14 @@
=== tests/cases/compiler/functionExpressionWithResolutionOfTypeOfSameName02.ts ===
interface Foo {
>Foo : Foo
}
var x = function Foo() {
>x : () => void
>function Foo() { var x: Foo;} : () => void
>Foo : () => void
var x: Foo;
>x : Foo
>Foo : Foo
}

View File

@ -1 +1,2 @@
// @experimentaldecorators: true
var v = @decorate class C { static p = 1 };

View File

@ -0,0 +1,8 @@
namespace C {
export interface type {
}
}
var x = class C {
prop: C.type;
}

View File

@ -0,0 +1,6 @@
interface arguments {
}
function f() {
<arguments>arguments;
}

View File

@ -0,0 +1,6 @@
interface f {
}
function f() {
<f>f;
}

View File

@ -0,0 +1,6 @@
interface arguments {
}
var x = function f() {
<arguments>arguments;
}

View File

@ -0,0 +1,6 @@
interface f {
}
var x = function f() {
<f>f;
}

View File

@ -0,0 +1,6 @@
interface Foo {
}
var x = function Foo() {
var x: Foo;
}

View File

@ -1,4 +1,5 @@
// @noemithelpers: true
// @experimentaldecorators: true
// @emitdecoratormetadata: true
// @target: es5

View File

@ -1,5 +1,6 @@
// @sourcemap: true
// @target: es5
// @experimentaldecorators: true
declare function ClassDecorator1(target: Function): void;
declare function ClassDecorator2(x: number): (target: Function) => void;
declare function PropertyDecorator1(target: Object, key: string | symbol, descriptor?: PropertyDescriptor): void;

View File

@ -1,4 +1,5 @@
// @target:es5
// @experimentaldecorators: true
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
class C {

View File

@ -1,4 +1,5 @@
// @target:es5
// @experimentaldecorators: true
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
class C {

View File

@ -1,4 +1,5 @@
// @target:es5
// @experimentaldecorators: true
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
class C {

View File

@ -1,4 +1,5 @@
// @target:es5
// @experimentaldecorators: true
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
class C {

View File

@ -1,4 +1,5 @@
// @target:es5
// @experimentaldecorators: true
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
class C {

View File

@ -1,4 +1,5 @@
// @target:es5
// @experimentaldecorators: true
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
class C {

View File

@ -1,4 +1,5 @@
// @target:es5
// @experimentaldecorators: true
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
class C {

View File

@ -1,4 +1,5 @@
// @target:es5
// @experimentaldecorators: true
declare function dec(target: Function, propertyKey: string | symbol, parameterIndex: number): void;
class C {

View File

@ -1,4 +1,5 @@
// @target:es5
// @experimentaldecorators: true
declare function dec(target: Function, propertyKey: string | symbol, parameterIndex: number): void;
class C {

View File

@ -1,4 +1,5 @@
// @target: es6
// @experimentaldecorators: true
// @Filename: decorated.ts
function decorate() { }

View File

@ -1,4 +1,5 @@
// @target:es5
// @experimentaldecorators: true
// from #2971
function func(s: string): void {

View File

@ -1,5 +1,6 @@
// @target:es5
// @module:commonjs
// @experimentaldecorators: true
// @filename: a.ts
// from #3108

View File

@ -1,4 +1,5 @@
// @target:es5
// @experimentaldecorators: true
declare function dec<T>(target: T): T;
@dec

View File

@ -1,5 +1,6 @@
// @target:es5
// @module: commonjs
// @experimentaldecorators: true
declare function dec<T>(target: T): T;
@dec

View File

@ -1,5 +1,6 @@
// @target:es5
// @module: commonjs
// @experimentaldecorators: true
declare function dec<T>(target: T): T;
export

View File

@ -1,4 +1,5 @@
// @target:es5
// @experimentaldecorators: true
declare function dec(): <T>(target: T) => T;
@dec()

View File

@ -1,4 +1,5 @@
// @target:es5
// @experimentaldecorators: true
declare function dec(): <T>(target: T) => T;
@dec()

View File

@ -1,4 +1,5 @@
// @target:es5
// @experimentaldecorators: true
declare function dec(): (target: Function, paramIndex: number) => void;
@dec()

View File

@ -1,4 +1,5 @@
// @target: ES5
// @experimentaldecorators: true
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
class C {

View File

@ -1,4 +1,5 @@
// @target: ES5
// @experimentaldecorators: true
declare function dec(target: Function, paramIndex: number): void;
class C {

View File

@ -1,4 +1,5 @@
// @target: ES5
// @experimentaldecorators: true
module M {
class C {
decorator(target: Object, key: string): void { }

View File

@ -1,4 +1,5 @@
// @target: ES5
// @experimentaldecorators: true
module M {
class S {
decorator(target: Object, key: string): void { }

View File

@ -1,4 +1,5 @@
// @target: ES6
// @experimentaldecorators: true
declare function dec(): <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>;
class C {

View File

@ -1,4 +1,5 @@
// @target: ES5
// @experimentaldecorators: true
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
class C {

View File

@ -1,4 +1,5 @@
// @target: ES5
// @experimentaldecorators: true
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
class C {

View File

@ -1,4 +1,5 @@
// @target: ES6
// @experimentaldecorators: true
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
class C {

View File

@ -1,4 +1,5 @@
// @target: ES6
// @experimentaldecorators: true
declare function dec(): <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>;
class C {

View File

@ -1,4 +1,5 @@
// @target: ES6
// @experimentaldecorators: true
declare function dec(): <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>;
class C {

View File

@ -1,4 +1,5 @@
// @target: ES6
// @experimentaldecorators: true
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
class C {

View File

@ -1,4 +1,5 @@
// @target: ES5
// @experimentaldecorators: true
declare function dec<T>(target: T): T;
class C {

View File

@ -1,4 +1,5 @@
// @target:es5
// @experimentaldecorators: true
declare function dec(target: Function, propertyKey: string | symbol, parameterIndex: number): void;
class C {

View File

@ -1,4 +1,5 @@
// @target: ES5
// @experimentaldecorators: true
declare function dec(target: any, propertyKey: string): void;
class C {

View File

@ -1,4 +1,5 @@
// @target: ES5
// @experimentaldecorators: true
declare function dec(): <T>(target: any, propertyKey: string) => void;
class C {

View File

@ -1,4 +1,5 @@
// @target: ES5
// @experimentaldecorators: true
declare function dec(): <T>(target: any, propertyKey: string) => void;
class C {

View File

@ -1,4 +1,5 @@
// @target: ES5
// @experimentaldecorators: true
declare function dec(target: any, propertyKey: string): void;
class C {

View File

@ -1,4 +1,5 @@
// @target: ES5
// @experimentaldecorators: true
declare function dec(target: any, propertyKey: string): void;
class C {

View File

@ -1,4 +1,5 @@
// @target: ES5
// @experimentaldecorators: true
declare function dec(target: Function): void;
class C {

View File

@ -1,4 +1,5 @@
// @target: ES5
// @experimentaldecorators: true
declare function dec(target: Function, propertyKey: string | symbol, paramIndex: number): void;
class C {

View File

@ -1,4 +1,5 @@
// @target: ES5
// @target: ES5
// @experimentaldecorators: true
// @noLib: true
// @Filename: a.ts
@ -11,8 +12,7 @@ interface Function { }
interface RegExp { }
interface IArguments { }
// @Filename: b.ts
/// <reference path="a.ts" />
// @Filename: b.ts
declare var dec: any;
@dec