-
Notifications
You must be signed in to change notification settings - Fork 12.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1261 from Microsoft/contextFlags
Use a separate field on a node to specify parser context flags.
- Loading branch information
Showing
177 changed files
with
1,782 additions
and
411 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,24 @@ | ||
///<reference path='references.ts' /> | ||
|
||
module TypeScript { | ||
export const enum ParserContextFlags { | ||
StrictMode = 1 << 0, | ||
DisallowIn = 1 << 1, | ||
Yield = 1 << 2, | ||
GeneratorParameter = 1 << 3, | ||
|
||
Mask = 0xF | ||
} | ||
|
||
export enum SyntaxNodeConstants { | ||
None = 0, | ||
|
||
// Masks that we use to place information about a node into a single int. The first bit tells | ||
// us if we've computed the data for a node. | ||
// | ||
// The second bit tells us if the node is incrementally reusable if it does not | ||
// containe any skipped tokens, zero width tokens, regex tokens in it ("/", "/=" or "/.../"), | ||
// and contains no tokens that were parser generated. | ||
// | ||
// The next bit lets us know if the nodes was parsed in a strict context or node. A node can | ||
// 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 first four bit of the flags are used to store parser context flags. | ||
// 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. | ||
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 | ||
DataComputed = 1 << 4, // 0000 0000 0000 0000 0000 0000 0001 0000 | ||
IncrementallyUnusableMask = 1 << 5, // 0000 0000 0000 0000 0000 0000 0010 0000 | ||
FullWidthShift = 1 << 6, // 1111 1111 1111 1111 1111 1111 1100 0000 | ||
} | ||
} |
Oops, something went wrong.