Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(956)

Unified Diff: test/cctest/test-parsing.cc

Issue 2663043003: [parser] Skipping inner funcs: make preparser scope analysis work w/ destructuring declarations. (Closed)
Patch Set: moar Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-parsing.cc
diff --git a/test/cctest/test-parsing.cc b/test/cctest/test-parsing.cc
index 37b40e37ae3bb204d045b4531ff948c901cee7ad..cdec0a0aa1cf6beeb9280d5701112b2ca2cf7d0b 100644
--- a/test/cctest/test-parsing.cc
+++ b/test/cctest/test-parsing.cc
@@ -8707,7 +8707,9 @@ class ScopeTestHelper {
int inner_scope_count = 0;
for (Scope* inner = scope->inner_scope(); inner != nullptr;
inner = inner->sibling()) {
- ++inner_scope_count;
+ if (!inner->is_hidden()) {
+ ++inner_scope_count;
+ }
}
CHECK_EQ(data->backing_store_[index++], inner_scope_count);
@@ -8739,7 +8741,9 @@ class ScopeTestHelper {
for (Scope* inner = scope->inner_scope(); inner != nullptr;
inner = inner->sibling()) {
- CompareScopeToData(inner, data, index);
+ if (!inner->is_hidden()) {
+ CompareScopeToData(inner, data, index);
+ }
}
}
};
@@ -9100,6 +9104,36 @@ TEST(PreParserScopeAnalysis) {
{"", "const arguments = 5;"},
{"", "if (true) { const arguments = 5; }"},
{"", "const arguments = 5; function f() { arguments; }"},
+
+ {"", "var [var1, var2] = [1, 2];"},
+ {"", "var [var1, var2, [var3, var4]] = [1, 2, [3, 4]];"},
+ {"", "var [{var1: var2}, {var3: var4}] = [{var1: 1}, {var3: 2}];"},
+ {"", "var [var1, ...var2] = [1, 2, 3];"},
+
+ {"", "var {var1: var2, var3: var4} = {var1: 1, var3: 2};"},
+ {"",
+ "var {var1: var2, var3: {var4: var5}} = {var1: 1, var3: {var4: 2}};"},
+ {"", "var {var1: var2, var3: [var4, var5]} = {var1: 1, var3: [2, 3]};"},
+
+ {"", "let [var1, var2] = [1, 2];"},
+ {"", "let [var1, var2, [var3, var4]] = [1, 2, [3, 4]];"},
+ {"", "let [{var1: var2}, {var3: var4}] = [{var1: 1}, {var3: 2}];"},
+ {"", "let [var1, ...var2] = [1, 2, 3];"},
+
+ {"", "let {var1: var2, var3: var4} = {var1: 1, var3: 2};"},
+ {"",
+ "let {var1: var2, var3: {var4: var5}} = {var1: 1, var3: {var4: 2}};"},
+ {"", "let {var1: var2, var3: [var4, var5]} = {var1: 1, var3: [2, 3]};"},
+
+ {"", "const [var1, var2] = [1, 2];"},
+ {"", "const [var1, var2, [var3, var4]] = [1, 2, [3, 4]];"},
+ {"", "const [{var1: var2}, {var3: var4}] = [{var1: 1}, {var3: 2}];"},
+ {"", "const [var1, ...var2] = [1, 2, 3];"},
+
+ {"", "const {var1: var2, var3: var4} = {var1: 1, var3: 2};"},
+ {"",
+ "const {var1: var2, var3: {var4: var5}} = {var1: 1, var3: {var4: 2}};"},
+ {"", "const {var1: var2, var3: [var4, var5]} = {var1: 1, var3: [2, 3]};"},
};
for (unsigned i = 0; i < arraysize(inners); ++i) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698