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

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

Issue 2670633003: [parser] Skipping inner funcs: produce the same scopes / variables for sloppy block funcs. (Closed)
Patch Set: code review (vogelheim@) 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
« src/ast/scopes.cc ('K') | « src/parsing/preparser.cc ('k') | 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 c13f22517ea82c2f17ece75d2c58265c63f55003..ba7fa4ec28f7acb1568e3af60140f275b89d7a71 100644
--- a/test/cctest/test-parsing.cc
+++ b/test/cctest/test-parsing.cc
@@ -9332,8 +9332,12 @@ TEST(PreParserScopeAnalysis) {
{"", "for (let var1 = 0; var1 < 10; ++var1) { }"},
{"", "for (const var1 = 0; var1 < 10; ++var1) { }"},
- // FIXME(marja): make the corresponding cases work when foo is a sloppy
- // block function.
+ {"",
+ "for (var var1 = 0; var1 < 10; ++var1) { function foo() { var1; } }"},
+ {"",
+ "for (let var1 = 0; var1 < 10; ++var1) { function foo() { var1; } }"},
+ {"",
+ "for (const var1 = 0; var1 < 10; ++var1) { function foo() { var1; } }"},
{"",
"'use strict'; for (var var1 = 0; var1 < 10; ++var1) { function foo() { "
"var1; } }"},
@@ -9343,6 +9347,34 @@ TEST(PreParserScopeAnalysis) {
{"",
"'use strict'; for (const var1 = 0; var1 < 10; ++var1) { function foo() "
"{ var1; } }"},
+
+ {"", "if (true) { function f1() {} }"},
+ {"", "if (true) { function f1() {} function f1() {} }"},
+ {"", "if (true) { if (true) { function f1() {} } }"},
+ {"", "if (true) { if (true) { function f1() {} function f1() {} } }"},
+ {"", "if (true) { function f1() {} f1 = 3; }"},
+
+ {"", "if (true) { function f1() {} function foo() { f1; } }"},
+ {"", "if (true) { function f1() {} } function foo() { f1; }"},
+ {"",
+ "if (true) { function f1() {} function f1() {} function foo() { f1; } "
+ "}"},
+ {"",
+ "if (true) { function f1() {} function f1() {} } function foo() { f1; "
+ "}"},
+ {"",
+ "if (true) { if (true) { function f1() {} } function foo() { f1; } }"},
+ {"",
+ "if (true) { if (true) { function f1() {} function f1() {} } function "
+ "foo() { f1; } }"},
+ {"", "if (true) { function f1() {} f1 = 3; function foo() { f1; } }"},
+ {"", "if (true) { function f1() {} f1 = 3; } function foo() { f1; }"},
+
+ {"", "function inner2() { if (true) { function f1() {} } }"},
+ {"", "function inner2() { if (true) { function f1() {} f1 = 3; } }"},
+
+ {"", "var f1 = 1; if (true) { function f1() {} }"},
+ {"", "var f1 = 1; if (true) { function f1() {} } function foo() { f1; }"},
};
for (unsigned i = 0; i < arraysize(inners); ++i) {
« src/ast/scopes.cc ('K') | « src/parsing/preparser.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698