-
Notifications
You must be signed in to change notification settings - Fork 12.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add binding elements from variable declaration into script lexical st…
…ructure
- Loading branch information
Showing
2 changed files
with
43 additions
and
8 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
19 changes: 18 additions & 1 deletion
19
tests/cases/fourslash/scriptLexicalStructureBindingPatterns.ts
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,4 +1,21 @@ | ||
/// <reference path='fourslash.ts'/> | ||
////'use strict' | ||
This comment has been minimized.
Sorry, something went wrong. |
||
////var foo, {} | ||
////var bar, [] | ||
verify.getScriptLexicalStructureListCount(3); // global (1) + variable declarations (2) | ||
////let foo1, {a, b} | ||
////const bar1, [c, d] | ||
////var {e, x: [f, g]} = {a:1, x:[]}; | ||
|
||
verify.getScriptLexicalStructureListCount(12); // global (1) + variable declarations (4) + binding patterns (7) | ||
verify.getScriptLexicalStructureListContains("foo", "var"); | ||
verify.getScriptLexicalStructureListContains("bar", "var"); | ||
verify.getScriptLexicalStructureListContains("foo1", "let") | ||
verify.getScriptLexicalStructureListContains("a", "let"); | ||
verify.getScriptLexicalStructureListContains("b", "let"); | ||
verify.getScriptLexicalStructureListContains("bar1", "const"); | ||
verify.getScriptLexicalStructureListContains("c", "const"); | ||
verify.getScriptLexicalStructureListContains("d", "const"); | ||
verify.getScriptLexicalStructureListContains("e", "var"); | ||
verify.getScriptLexicalStructureListContains("f", "var"); | ||
verify.getScriptLexicalStructureListContains("g", "var"); | ||
|
How does this assert not crash for an assignment pattern?