Skip to content

Commit

Permalink
Merge pull request #1129 from Microsoft/yieldExpressions
Browse files Browse the repository at this point in the history
Parsing support (including incremental parsing) for 'yield' expressions.
  • Loading branch information
CyrusNajmabadi committed Nov 14, 2014
2 parents 00a9456 + f7890d4 commit bc40997
Show file tree
Hide file tree
Showing 16 changed files with 802 additions and 322 deletions.
1 change: 1 addition & 0 deletions src/services/resources/diagnosticCode.generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ module TypeScript {
Type_expected: "Type expected.",
Template_literal_cannot_be_used_as_an_element_name: "Template literal cannot be used as an element name.",
Computed_property_names_cannot_be_used_here: "Computed property names cannot be used here.",
yield_expression_must_be_contained_within_a_generator_declaration: "'yield' expression must be contained within a generator declaration.",
Duplicate_identifier_0: "Duplicate identifier '{0}'.",
The_name_0_does_not_exist_in_the_current_scope: "The name '{0}' does not exist in the current scope.",
The_name_0_does_not_refer_to_a_value: "The name '{0}' does not refer to a value.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ module TypeScript {
"Type expected.": { "code": 1110, "category": DiagnosticCategory.Error },
"Template literal cannot be used as an element name.": { "code": 1111, "category": DiagnosticCategory.Error },
"Computed property names cannot be used here.": { "code": 1112, "category": DiagnosticCategory.Error },
"'yield' expression must be contained within a generator declaration.": { "code": 1113, "category": DiagnosticCategory.Error },
"Duplicate identifier '{0}'.": { "code": 2000, "category": DiagnosticCategory.Error },
"The name '{0}' does not exist in the current scope.": { "code": 2001, "category": DiagnosticCategory.Error },
"The name '{0}' does not refer to a value.": { "code": 2002, "category": DiagnosticCategory.Error },
Expand Down
4 changes: 4 additions & 0 deletions src/services/resources/diagnosticMessages.json
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,10 @@
"category": "Error",
"code": 1112
},
"'yield' expression must be contained within a generator declaration.": {
"category": "Error",
"code": 1113
},
"Duplicate identifier '{0}'.": {
"category": "Error",
"code": 2000
Expand Down
101 changes: 58 additions & 43 deletions src/services/syntax/SyntaxGenerator.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions src/services/syntax/SyntaxGenerator.js.map

Large diffs are not rendered by default.

18 changes: 10 additions & 8 deletions src/services/syntax/constants.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
///<reference path='references.ts' />

module TypeScript {
export enum SyntaxConstants {
export enum SyntaxNodeConstants {
None = 0,

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

0 comments on commit bc40997

Please sign in to comment.