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

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

Issue 2636543002: PreParser scope analysis: sloppy block funcs. (Closed)
Patch Set: proactive code review 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 | « 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 a3ee6bea045ad4c9a788922a1ed833f44b9c291e..84869ca0cc1f8af05d187effc8695655bda3c5d1 100644
--- a/test/cctest/test-parsing.cc
+++ b/test/cctest/test-parsing.cc
@@ -8615,6 +8615,21 @@ TEST(NoPessimisticContextAllocation) {
{"function inner() { for (let my_var = 0; my_var < 1; ++my_var) { } "
"my_var }",
true},
+ {"function inner() { 'use strict'; if (true) { function my_var() {} } "
+ "my_var; }",
+ true},
+ {"function inner() { 'use strict'; function inner2() { if (true) { "
+ "function my_var() {} } my_var; } }",
+ true},
+ {"function inner() { function inner2() { 'use strict'; if (true) { "
+ "function my_var() {} } my_var; } }",
+ true},
+ {"function inner() { () => { 'use strict'; if (true) { function my_var() "
+ "{} } my_var; } }",
+ true},
+ {"function inner() { if (true) { let my_var; if (true) { function "
+ "my_var() {} } } my_var; }",
+ true},
// No pessimistic context allocation:
{"function inner() { var my_var; my_var; }", false},
{"function inner() { var my_var; }", false},
@@ -8806,10 +8821,18 @@ TEST(NoPessimisticContextAllocation) {
"my_var } }",
false},
{"function inner() { class my_var {}; my_var }", false},
- // In the following cases we still context allocate pessimistically:
- {"function inner() { function my_var() {} my_var; }", true},
+ {"function inner() { function my_var() {} my_var; }", false},
{"function inner() { if (true) { function my_var() {} } my_var; }",
- true},
+ false},
+ {"function inner() { function inner2() { if (true) { function my_var() "
+ "{} } my_var; } }",
+ false},
+ {"function inner() { () => { if (true) { function my_var() {} } my_var; "
+ "} }",
+ false},
+ {"function inner() { if (true) { var my_var; if (true) { function "
+ "my_var() {} } } my_var; }",
+ false},
};
for (unsigned i = 0; i < arraysize(inners); ++i) {
« no previous file with comments | « src/parsing/preparser.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698