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

Unified Diff: src/parsing/preparsed-scope-data.cc

Issue 2657943003: [parser] Skipping inner funcs: add variable names into the data for test purposes. (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
« no previous file with comments | « src/parsing/preparsed-scope-data.h ('k') | test/cctest/test-parsing.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parsing/preparsed-scope-data.cc
diff --git a/src/parsing/preparsed-scope-data.cc b/src/parsing/preparsed-scope-data.cc
index 50a4e0b63c491090c3ca88e71d3c73dc4a75628d..b9d1353fbfbce48bfc9c4bd61cfc653f2ac8511c 100644
--- a/src/parsing/preparsed-scope-data.cc
+++ b/src/parsing/preparsed-scope-data.cc
@@ -4,6 +4,9 @@
#include "src/parsing/preparsed-scope-data.h"
+#include "src/ast/variables.h"
+#include "src/objects-inl.h"
+
namespace v8 {
namespace internal {
@@ -35,11 +38,20 @@ PreParsedScopeData::ScopeScope::~ScopeScope() {
data_->backing_store_[index_in_data_ + 1] = variable_count_;
}
-void PreParsedScopeData::ScopeScope::AddVariable(VariableLocation location,
- bool maybe_assigned) {
- data_->backing_store_.push_back(location);
- data_->backing_store_.push_back(maybe_assigned);
- ++variable_count_;
+void PreParsedScopeData::ScopeScope::MaybeAddVariable(Variable* var) {
+ if (var->mode() == VAR || var->mode() == LET || var->mode() == CONST) {
+#ifdef DEBUG
+ // For tests (which check that the data is about the same variables).
+ const AstRawString* name = var->raw_name();
+ data_->backing_store_.push_back(name->length());
+ for (int i = 0; i < name->length(); ++i) {
+ data_->backing_store_.push_back(name->raw_data()[i]);
+ }
+#endif
+ data_->backing_store_.push_back(var->location());
+ data_->backing_store_.push_back(var->maybe_assigned());
+ ++variable_count_;
+ }
}
} // namespace internal
« no previous file with comments | « src/parsing/preparsed-scope-data.h ('k') | test/cctest/test-parsing.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698