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

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

Issue 2655623005: [parser] Skipping inner funcs: add info about variables. (Closed)
Patch Set: create variables only when the flag is on 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 1ea1b5ad7f4dbcc0cf0bd445a8adcd595e92dfcb..5855d376fb5834c52a86519de5bf2ca28dc8cb77 100644
--- a/test/cctest/test-parsing.cc
+++ b/test/cctest/test-parsing.cc
@@ -8711,8 +8711,23 @@ class ScopeTestHelper {
}
CHECK_EQ(data->backing_store_[index++], inner_scope_count);
- // Variable count is 0. TODO(marja): implement.
- CHECK_EQ(data->backing_store_[index++], 0);
+ int variable_count = 0;
+ for (Variable* local : scope->locals_) {
+ if (local->mode() == VAR || local->mode() == LET ||
+ local->mode() == CONST) {
+ ++variable_count;
+ }
+ }
+
+ CHECK_EQ(data->backing_store_[index++], variable_count);
vogelheim 2017/01/26 09:34:35 Why does this work? The way I read Scope::CollectV
marja 2017/01/26 09:40:59 Offline discussion: the scope contains only the va
+
+ for (Variable* local : scope->locals_) {
+ if (local->mode() == VAR || local->mode() == LET ||
+ local->mode() == CONST) {
+ CHECK_EQ(data->backing_store_[index++], local->location());
+ CHECK_EQ(data->backing_store_[index++], local->maybe_assigned());
+ }
+ }
for (Scope* inner = scope->inner_scope(); inner != nullptr;
inner = inner->sibling()) {
@@ -9022,7 +9037,6 @@ TEST(PreParserScopeAnalysis) {
{"", "var1"},
{"", "if (true) {}"},
{"", "function f1() {}"},
- {"", "if (true) { function f1() {} }"},
};
for (unsigned i = 0; i < arraysize(inners); ++i) {
@@ -9076,6 +9090,7 @@ TEST(PreParserScopeAnalysis) {
script = factory->NewScript(source);
i::ParseInfo eager_info(&zone, script);
+ eager_info.set_allow_lazy_parsing(false);
CHECK(i::parsing::ParseProgram(&eager_info));
CHECK(i::Compiler::Analyze(&eager_info));
« 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