Skip to content

Commit 040dbd9

Browse files
author
Zhengbo Li
committed
Merge branch 'master' of https://github.com/Microsoft/TypeScript into ms_master
2 parents 321cfab + f79f5bb commit 040dbd9

388 files changed

Lines changed: 6919 additions & 1070 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "typescript",
33
"author": "Microsoft Corp.",
44
"homepage": "http://typescriptlang.org/",
5-
"version": "1.5.2",
5+
"version": "1.5.3",
66
"license": "Apache-2.0",
77
"description": "TypeScript is a language for application scale JavaScript development",
88
"keywords": [

src/compiler/binder.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -519,17 +519,17 @@ module ts {
519519
bindBlockScopedDeclaration(<Declaration>node, SymbolFlags.Class, SymbolFlags.ClassExcludes);
520520
break;
521521
case SyntaxKind.InterfaceDeclaration:
522-
bindDeclaration(<Declaration>node, SymbolFlags.Interface, SymbolFlags.InterfaceExcludes, /*isBlockScopeContainer*/ false);
522+
bindBlockScopedDeclaration(<Declaration>node, SymbolFlags.Interface, SymbolFlags.InterfaceExcludes);
523523
break;
524524
case SyntaxKind.TypeAliasDeclaration:
525-
bindDeclaration(<Declaration>node, SymbolFlags.TypeAlias, SymbolFlags.TypeAliasExcludes, /*isBlockScopeContainer*/ false);
525+
bindBlockScopedDeclaration(<Declaration>node, SymbolFlags.TypeAlias, SymbolFlags.TypeAliasExcludes);
526526
break;
527527
case SyntaxKind.EnumDeclaration:
528528
if (isConst(node)) {
529-
bindDeclaration(<Declaration>node, SymbolFlags.ConstEnum, SymbolFlags.ConstEnumExcludes, /*isBlockScopeContainer*/ false);
529+
bindBlockScopedDeclaration(<Declaration>node, SymbolFlags.ConstEnum, SymbolFlags.ConstEnumExcludes);
530530
}
531531
else {
532-
bindDeclaration(<Declaration>node, SymbolFlags.RegularEnum, SymbolFlags.RegularEnumExcludes, /*isBlockScopeContainer*/ false);
532+
bindBlockScopedDeclaration(<Declaration>node, SymbolFlags.RegularEnum, SymbolFlags.RegularEnumExcludes);
533533
}
534534
break;
535535
case SyntaxKind.ModuleDeclaration:

src/compiler/checker.ts

Lines changed: 518 additions & 266 deletions
Large diffs are not rendered by default.

src/compiler/core.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,16 @@ module ts {
129129
}
130130
}
131131

132+
export function rangeEquals<T>(array1: T[], array2: T[], pos: number, end: number) {
133+
while (pos < end) {
134+
if (array1[pos] !== array2[pos]) {
135+
return false;
136+
}
137+
pos++;
138+
}
139+
return true;
140+
}
141+
132142
/**
133143
* Returns the last element of an array if non-empty, undefined otherwise.
134144
*/

src/compiler/diagnosticInformationMap.generated.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ module ts {
120120
Unterminated_template_literal: { code: 1160, category: DiagnosticCategory.Error, key: "Unterminated template literal." },
121121
Unterminated_regular_expression_literal: { code: 1161, category: DiagnosticCategory.Error, key: "Unterminated regular expression literal." },
122122
An_object_member_cannot_be_declared_optional: { code: 1162, category: DiagnosticCategory.Error, key: "An object member cannot be declared optional." },
123-
yield_expression_must_be_contained_within_a_generator_declaration: { code: 1163, category: DiagnosticCategory.Error, key: "'yield' expression must be contained_within a generator declaration." },
123+
A_yield_expression_is_only_allowed_in_a_generator_body: { code: 1163, category: DiagnosticCategory.Error, key: "A 'yield' expression is only allowed in a generator body." },
124124
Computed_property_names_are_not_allowed_in_enums: { code: 1164, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in enums." },
125125
A_computed_property_name_in_an_ambient_context_must_directly_refer_to_a_built_in_symbol: { code: 1165, category: DiagnosticCategory.Error, key: "A computed property name in an ambient context must directly refer to a built-in symbol." },
126126
A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol: { code: 1166, category: DiagnosticCategory.Error, key: "A computed property name in a class property declaration must directly refer to a built-in symbol." },
@@ -174,7 +174,10 @@ module ts {
174174
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" },
175175
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." },
176176
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'." },
177-
_0_tag_already_specified: { code: 1219, category: DiagnosticCategory.Error, key: "'{0}' tag already specified." },
177+
Generators_are_only_available_when_targeting_ECMAScript_6_or_higher: { code: 1219, category: DiagnosticCategory.Error, key: "Generators are only available when targeting ECMAScript 6 or higher." },
178+
Generators_are_not_allowed_in_an_ambient_context: { code: 1220, category: DiagnosticCategory.Error, key: "Generators are not allowed in an ambient context." },
179+
An_overload_signature_cannot_be_declared_as_a_generator: { code: 1221, category: DiagnosticCategory.Error, key: "An overload signature cannot be declared as a generator." },
180+
_0_tag_already_specified: { code: 1222, category: DiagnosticCategory.Error, key: "'{0}' tag already specified." },
178181
Duplicate_identifier_0: { code: 2300, category: DiagnosticCategory.Error, key: "Duplicate identifier '{0}'." },
179182
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." },
180183
Static_members_cannot_reference_class_type_parameters: { code: 2302, category: DiagnosticCategory.Error, key: "Static members cannot reference class type parameters." },
@@ -366,6 +369,8 @@ module ts {
366369
A_rest_element_cannot_contain_a_binding_pattern: { code: 2501, category: DiagnosticCategory.Error, key: "A rest element cannot contain a binding pattern." },
367370
_0_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { code: 2502, category: DiagnosticCategory.Error, key: "'{0}' is referenced directly or indirectly in its own type annotation." },
368371
Cannot_find_namespace_0: { code: 2503, category: DiagnosticCategory.Error, key: "Cannot find namespace '{0}'." },
372+
No_best_common_type_exists_among_yield_expressions: { code: 2504, category: DiagnosticCategory.Error, key: "No best common type exists among yield expressions." },
373+
A_generator_cannot_have_a_void_type_annotation: { code: 2505, category: DiagnosticCategory.Error, key: "A generator cannot have a 'void' type annotation." },
369374
Import_declaration_0_is_using_private_name_1: { code: 4000, category: DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." },
370375
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." },
371376
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." },
@@ -523,6 +528,7 @@ module ts {
523528
_0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer: { code: 7022, category: DiagnosticCategory.Error, key: "'{0}' implicitly has type 'any' because it is does not have a type annotation and is referenced directly or indirectly in its own initializer." },
524529
_0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7023, category: DiagnosticCategory.Error, key: "'{0}' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." },
525530
Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7024, category: DiagnosticCategory.Error, key: "Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." },
531+
Generator_implicitly_has_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_type: { code: 7025, category: DiagnosticCategory.Error, key: "Generator implicitly has type '{0}' because it does not yield any values. Consider supplying a return type." },
526532
You_cannot_rename_this_element: { code: 8000, category: DiagnosticCategory.Error, key: "You cannot rename this element." },
527533
You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library: { code: 8001, category: DiagnosticCategory.Error, key: "You cannot rename elements that are defined in the standard TypeScript library." },
528534
import_can_only_be_used_in_a_ts_file: { code: 8002, category: DiagnosticCategory.Error, key: "'import ... =' can only be used in a .ts file." },
@@ -540,10 +546,7 @@ module ts {
540546
enum_declarations_can_only_be_used_in_a_ts_file: { code: 8015, category: DiagnosticCategory.Error, key: "'enum declarations' can only be used in a .ts file." },
541547
type_assertion_expressions_can_only_be_used_in_a_ts_file: { code: 8016, category: DiagnosticCategory.Error, key: "'type assertion expressions' can only be used in a .ts file." },
542548
decorators_can_only_be_used_in_a_ts_file: { code: 8017, category: DiagnosticCategory.Error, key: "'decorators' can only be used in a .ts file." },
543-
yield_expressions_are_not_currently_supported: { code: 9000, category: DiagnosticCategory.Error, key: "'yield' expressions are not currently supported." },
544-
Generators_are_not_currently_supported: { code: 9001, category: DiagnosticCategory.Error, key: "Generators are not currently supported." },
545549
Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_class_extends_clauses: { code: 9002, category: DiagnosticCategory.Error, key: "Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses." },
546550
class_expressions_are_not_currently_supported: { code: 9003, category: DiagnosticCategory.Error, key: "'class' expressions are not currently supported." },
547-
class_declarations_are_only_supported_directly_inside_a_module_or_as_a_top_level_declaration: { code: 9004, category: DiagnosticCategory.Error, key: "'class' declarations are only supported directly inside a module or as a top level declaration." },
548551
};
549552
}

src/compiler/diagnosticMessages.json

Lines changed: 30 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@
467467
"category": "Error",
468468
"code": 1162
469469
},
470-
"'yield' expression must be contained_within a generator declaration.": {
470+
"A 'yield' expression is only allowed in a generator body.": {
471471
"category": "Error",
472472
"code": 1163
473473
},
@@ -682,10 +682,24 @@
682682
"Export assignment is not supported when '--module' flag is 'system'.": {
683683
"category": "Error",
684684
"code": 1218
685+
},
686+
"Generators are only available when targeting ECMAScript 6 or higher.": {
687+
"category": "Error",
688+
"code": 1219
689+
},
690+
"Generators are not allowed in an ambient context.": {
691+
"category": "Error",
692+
"code": 1220
693+
},
694+
"An overload signature cannot be declared as a generator.": {
695+
"category": "Error",
696+
"code": 1221
685697
},
698+
699+
686700
"'{0}' tag already specified.": {
687701
"category": "Error",
688-
"code": 1219
702+
"code": 1222
689703
},
690704
"Duplicate identifier '{0}'.": {
691705
"category": "Error",
@@ -1442,15 +1456,23 @@
14421456
"A rest element cannot contain a binding pattern.": {
14431457
"category": "Error",
14441458
"code": 2501
1445-
},
1459+
},
14461460
"'{0}' is referenced directly or indirectly in its own type annotation.": {
14471461
"category": "Error",
14481462
"code": 2502
1449-
},
1463+
},
14501464
"Cannot find namespace '{0}'.": {
14511465
"category": "Error",
14521466
"code": 2503
1467+
},
1468+
"No best common type exists among yield expressions.": {
1469+
"category": "Error",
1470+
"code": 2504
14531471
},
1472+
"A generator cannot have a 'void' type annotation.": {
1473+
"category": "Error",
1474+
"code": 2505
1475+
},
14541476

14551477
"Import declaration '{0}' is using private name '{1}'.": {
14561478
"category": "Error",
@@ -2083,6 +2105,10 @@
20832105
"category": "Error",
20842106
"code": 7024
20852107
},
2108+
"Generator implicitly has type '{0}' because it does not yield any values. Consider supplying a return type.": {
2109+
"category": "Error",
2110+
"code": 7025
2111+
},
20862112
"You cannot rename this element.": {
20872113
"category": "Error",
20882114
"code": 8000
@@ -2152,24 +2178,12 @@
21522178
"code": 8017
21532179
},
21542180

2155-
"'yield' expressions are not currently supported.": {
2156-
"category": "Error",
2157-
"code": 9000
2158-
},
2159-
"Generators are not currently supported.": {
2160-
"category": "Error",
2161-
"code": 9001
2162-
},
21632181
"Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses.": {
21642182
"category": "Error",
21652183
"code": 9002
21662184
},
21672185
"'class' expressions are not currently supported.": {
21682186
"category": "Error",
21692187
"code": 9003
2170-
},
2171-
"'class' declarations are only supported directly inside a module or as a top level declaration.": {
2172-
"category": "Error",
2173-
"code": 9004
21742188
}
21752189
}

0 commit comments

Comments
 (0)