Skip to content

Commit bc40997

Browse files
Merge pull request microsoft#1129 from Microsoft/yieldExpressions
Parsing support (including incremental parsing) for 'yield' expressions.
2 parents 00a9456 + f7890d4 commit bc40997

16 files changed

+802
-322
lines changed

src/services/resources/diagnosticCode.generated.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ module TypeScript {
9696
Type_expected: "Type expected.",
9797
Template_literal_cannot_be_used_as_an_element_name: "Template literal cannot be used as an element name.",
9898
Computed_property_names_cannot_be_used_here: "Computed property names cannot be used here.",
99+
yield_expression_must_be_contained_within_a_generator_declaration: "'yield' expression must be contained within a generator declaration.",
99100
Duplicate_identifier_0: "Duplicate identifier '{0}'.",
100101
The_name_0_does_not_exist_in_the_current_scope: "The name '{0}' does not exist in the current scope.",
101102
The_name_0_does_not_refer_to_a_value: "The name '{0}' does not refer to a value.",

src/services/resources/diagnosticInformationMap.generated.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ module TypeScript {
9898
"Type expected.": { "code": 1110, "category": DiagnosticCategory.Error },
9999
"Template literal cannot be used as an element name.": { "code": 1111, "category": DiagnosticCategory.Error },
100100
"Computed property names cannot be used here.": { "code": 1112, "category": DiagnosticCategory.Error },
101+
"'yield' expression must be contained within a generator declaration.": { "code": 1113, "category": DiagnosticCategory.Error },
101102
"Duplicate identifier '{0}'.": { "code": 2000, "category": DiagnosticCategory.Error },
102103
"The name '{0}' does not exist in the current scope.": { "code": 2001, "category": DiagnosticCategory.Error },
103104
"The name '{0}' does not refer to a value.": { "code": 2002, "category": DiagnosticCategory.Error },

src/services/resources/diagnosticMessages.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,10 @@
379379
"category": "Error",
380380
"code": 1112
381381
},
382+
"'yield' expression must be contained within a generator declaration.": {
383+
"category": "Error",
384+
"code": 1113
385+
},
382386
"Duplicate identifier '{0}'.": {
383387
"category": "Error",
384388
"code": 2000

src/services/syntax/SyntaxGenerator.js

Lines changed: 58 additions & 43 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/services/syntax/SyntaxGenerator.js.map

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/services/syntax/constants.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
///<reference path='references.ts' />
22

33
module TypeScript {
4-
export enum SyntaxConstants {
4+
export enum SyntaxNodeConstants {
55
None = 0,
66

77
// Masks that we use to place information about a node into a single int. The first bit tells
@@ -15,13 +15,15 @@ module TypeScript {
1515
// only be used by the incremental parser if it is parsed in the same strict context as before.
1616
// last masks off the part of the int
1717
//
18-
// The width of the node is stored in the remainder of the int. This allows us up to 256MB
19-
// for a node by using all 28 bits. However, in the common case, we'll use less than 28 bits
18+
// The width of the node is stored in the remainder of the int. This allows us up to 128MB
19+
// for a node by using all 27 bits. However, in the common case, we'll use less than 27 bits
2020
// for the width. Thus, the info will be stored in a single int in chakra.
21-
NodeDataComputed = 0x00000001, // 0000 0000 0000 0000 0000 0000 0000 0001
22-
NodeIncrementallyUnusableMask = 0x00000002, // 0000 0000 0000 0000 0000 0000 0000 0010
23-
NodeParsedInStrictModeMask = 0x00000004, // 0000 0000 0000 0000 0000 0000 0000 0100
24-
NodeParsedInDisallowInMask = 0x00000008, // 0000 0000 0000 0000 0000 0000 0000 1000
25-
NodeFullWidthShift = 4, // 1111 1111 1111 1111 1111 1111 1111 0000
21+
DataComputed = 0x00000001, // 0000 0000 0000 0000 0000 0000 0000 0001
22+
IncrementallyUnusableMask = 0x00000002, // 0000 0000 0000 0000 0000 0000 0000 0010
23+
ParsedInStrictModeContext = 0x00000004, // 0000 0000 0000 0000 0000 0000 0000 0100
24+
ParsedInDisallowInContext = 0x00000008, // 0000 0000 0000 0000 0000 0000 0000 1000
25+
ParsedInYieldContext = 0x00000010, // 0000 0000 0000 0000 0000 0000 0001 0000
26+
ParsedInGeneratorParameterContext = 0x00000020, // 0000 0000 0000 0000 0000 0000 0010 0000
27+
FullWidthShift = 1 << 6, // 1111 1111 1111 1111 1111 1111 1100 0000
2628
}
2729
}

0 commit comments

Comments
 (0)