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

Unified Diff: src/parsing/pattern-rewriter.cc

Issue 1487603003: [cleanup] Remove redundant fields from DeclarationDescriptor (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 1 month 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/parser.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parsing/pattern-rewriter.cc
diff --git a/src/parsing/pattern-rewriter.cc b/src/parsing/pattern-rewriter.cc
index 037e96b86d769d85bfbc9ada048e304c6a3f5b7a..9a0311e22e82a0527657a2b4472d1f429bdddd05 100644
--- a/src/parsing/pattern-rewriter.cc
+++ b/src/parsing/pattern-rewriter.cc
@@ -64,8 +64,10 @@ void Parser::PatternRewriter::VisitVariableProxy(VariableProxy* pattern) {
DCHECK(initializer_position_ != RelocInfo::kNoPosition);
- if (descriptor_->declaration_scope->num_var_or_const() >
- kMaxNumFunctionLocals) {
+ Scope* declaration_scope = IsLexicalVariableMode(descriptor_->mode)
+ ? descriptor_->scope
+ : descriptor_->scope->DeclarationScope();
+ if (declaration_scope->num_var_or_const() > kMaxNumFunctionLocals) {
parser->ReportMessage(MessageTemplate::kTooManyVariables);
*ok_ = false;
return;
@@ -100,8 +102,8 @@ void Parser::PatternRewriter::VisitVariableProxy(VariableProxy* pattern) {
// The "variable" c initialized to x is the same as the declared
// one - there is no re-lookup (see the last parameter of the
// Declare() call above).
- Scope* initialization_scope = descriptor_->is_const
- ? descriptor_->declaration_scope
+ Scope* initialization_scope = IsImmutableVariableMode(descriptor_->mode)
+ ? declaration_scope
: descriptor_->scope;
@@ -135,7 +137,7 @@ void Parser::PatternRewriter::VisitVariableProxy(VariableProxy* pattern) {
zone());
CallRuntime* initialize;
- if (descriptor_->is_const) {
+ if (IsImmutableVariableMode(descriptor_->mode)) {
arguments->Add(value, zone());
value = NULL; // zap the value to avoid the unnecessary assignment
« no previous file with comments | « src/parsing/parser.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698