| Index: src/parsing/pattern-rewriter.cc
|
| diff --git a/src/parsing/pattern-rewriter.cc b/src/parsing/pattern-rewriter.cc
|
| index 247f3f57c6cce3148c1013f4c67dc8cdeb550357..6f278bf7d6e7edc45e648aec6ebea90ff6a57161 100644
|
| --- a/src/parsing/pattern-rewriter.cc
|
| +++ b/src/parsing/pattern-rewriter.cc
|
| @@ -152,10 +152,15 @@ void Parser::PatternRewriter::VisitVariableProxy(VariableProxy* pattern) {
|
| parser_->scanner()->location().end_pos);
|
| Declaration* declaration = factory()->NewVariableDeclaration(
|
| proxy, descriptor_->scope, descriptor_->declaration_pos);
|
| - Variable* var = parser_->Declare(declaration, descriptor_->declaration_kind,
|
| - descriptor_->mode,
|
| - DefaultInitializationFlag(descriptor_->mode),
|
| - ok_, descriptor_->hoist_scope);
|
| + Scope* scope = descriptor_->hoist_scope;
|
| + if (scope == nullptr) {
|
| + scope = parser_->scope();
|
| + }
|
| + Variable* var = scope->DeclareVariableOrParameter(
|
| + declaration, descriptor_->declaration_kind, descriptor_->mode,
|
| + DefaultInitializationFlag(descriptor_->mode),
|
| + parser_->allow_harmony_restrictive_generators(),
|
| + &parser_->pending_error_handler_, parser_->use_counts_, ok_);
|
| if (!*ok_) return;
|
| DCHECK_NOT_NULL(var);
|
| DCHECK(proxy->is_resolved());
|
|
|