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

Side by Side Diff: src/parsing/preparser.cc

Issue 2662183002: [parser] Remove hoist_scope from DeclarationDescriptor (Closed)
Patch Set: Factored out helper function Created 3 years, 10 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 unified diff | Download patch
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <cmath> 5 #include <cmath>
6 6
7 #include "src/allocation.h" 7 #include "src/allocation.h"
8 #include "src/base/logging.h" 8 #include "src/base/logging.h"
9 #include "src/conversions-inl.h" 9 #include "src/conversions-inl.h"
10 #include "src/conversions.h" 10 #include "src/conversions.h"
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 return PreParserExpression::FromIdentifier(name, proxy, zone()); 300 return PreParserExpression::FromIdentifier(name, proxy, zone());
301 } 301 }
302 302
303 void PreParser::DeclareAndInitializeVariables( 303 void PreParser::DeclareAndInitializeVariables(
304 PreParserStatement block, 304 PreParserStatement block,
305 const DeclarationDescriptor* declaration_descriptor, 305 const DeclarationDescriptor* declaration_descriptor,
306 const DeclarationParsingResult::Declaration* declaration, 306 const DeclarationParsingResult::Declaration* declaration,
307 ZoneList<const AstRawString*>* names, bool* ok) { 307 ZoneList<const AstRawString*>* names, bool* ok) {
308 if (declaration->pattern.variables_ != nullptr) { 308 if (declaration->pattern.variables_ != nullptr) {
309 DCHECK(FLAG_lazy_inner_functions); 309 DCHECK(FLAG_lazy_inner_functions);
310 Scope* scope = declaration_descriptor->hoist_scope;
311 if (scope == nullptr) {
312 scope = this->scope();
313 }
314 for (auto variable : *(declaration->pattern.variables_)) { 310 for (auto variable : *(declaration->pattern.variables_)) {
315 declaration_descriptor->scope->RemoveUnresolved(variable); 311 declaration_descriptor->scope->RemoveUnresolved(variable);
316 scope->DeclareVariableName(variable->raw_name(), 312 scope()->DeclareVariableName(variable->raw_name(),
317 declaration_descriptor->mode); 313 declaration_descriptor->mode);
318 } 314 }
319 } 315 }
320 } 316 }
321 317
322 #undef CHECK_OK 318 #undef CHECK_OK
323 #undef CHECK_OK_CUSTOM 319 #undef CHECK_OK_CUSTOM
324 320
325 321
326 } // namespace internal 322 } // namespace internal
327 } // namespace v8 323 } // namespace v8
OLDNEW
« src/parsing/pattern-rewriter.cc ('K') | « src/parsing/pattern-rewriter.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698