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

Side by Side Diff: src/parsing/pattern-rewriter.cc

Issue 2349193002: Don't make immediately resolved proxies unresolved (Closed)
Patch Set: Created 4 years, 3 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
« no previous file with comments | « src/parsing/parser.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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 "src/ast/ast.h" 5 #include "src/ast/ast.h"
6 #include "src/messages.h" 6 #include "src/messages.h"
7 #include "src/parsing/parameter-initializer-rewriter.h" 7 #include "src/parsing/parameter-initializer-rewriter.h"
8 #include "src/parsing/parser.h" 8 #include "src/parsing/parser.h"
9 9
10 namespace v8 { 10 namespace v8 {
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 134
135 // Declare variable. 135 // Declare variable.
136 // Note that we *always* must treat the initial value via a separate init 136 // Note that we *always* must treat the initial value via a separate init
137 // assignment for variables and constants because the value must be assigned 137 // assignment for variables and constants because the value must be assigned
138 // when the variable is encountered in the source. But the variable/constant 138 // when the variable is encountered in the source. But the variable/constant
139 // is declared (and set to 'undefined') upon entering the function within 139 // is declared (and set to 'undefined') upon entering the function within
140 // which the variable or constant is declared. Only function variables have 140 // which the variable or constant is declared. Only function variables have
141 // an initial value in the declaration (because they are initialized upon 141 // an initial value in the declaration (because they are initialized upon
142 // entering the function). 142 // entering the function).
143 const AstRawString* name = pattern->raw_name(); 143 const AstRawString* name = pattern->raw_name();
144 VariableProxy* proxy = descriptor_->scope->NewUnresolved( 144 VariableProxy* proxy = factory()->NewVariableProxy(
145 factory(), name, parser_->scanner()->location().beg_pos, 145 name, NORMAL_VARIABLE, parser_->scanner()->location().beg_pos,
146 parser_->scanner()->location().end_pos); 146 parser_->scanner()->location().end_pos);
147 Declaration* declaration = factory()->NewVariableDeclaration( 147 Declaration* declaration = factory()->NewVariableDeclaration(
148 proxy, descriptor_->scope, descriptor_->declaration_pos); 148 proxy, descriptor_->scope, descriptor_->declaration_pos);
149 Variable* var = parser_->Declare( 149 Variable* var = parser_->Declare(
150 declaration, descriptor_->declaration_kind, descriptor_->mode, 150 declaration, descriptor_->declaration_kind, descriptor_->mode,
151 Variable::DefaultInitializationFlag(descriptor_->mode), ok_, 151 Variable::DefaultInitializationFlag(descriptor_->mode), ok_,
152 descriptor_->hoist_scope); 152 descriptor_->hoist_scope);
153 if (!*ok_) return; 153 if (!*ok_) return;
154 DCHECK_NOT_NULL(var); 154 DCHECK_NOT_NULL(var);
155 DCHECK(proxy->is_resolved()); 155 DCHECK(proxy->is_resolved());
(...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after
698 NOT_A_PATTERN(TryFinallyStatement) 698 NOT_A_PATTERN(TryFinallyStatement)
699 NOT_A_PATTERN(UnaryOperation) 699 NOT_A_PATTERN(UnaryOperation)
700 NOT_A_PATTERN(VariableDeclaration) 700 NOT_A_PATTERN(VariableDeclaration)
701 NOT_A_PATTERN(WhileStatement) 701 NOT_A_PATTERN(WhileStatement)
702 NOT_A_PATTERN(WithStatement) 702 NOT_A_PATTERN(WithStatement)
703 NOT_A_PATTERN(Yield) 703 NOT_A_PATTERN(Yield)
704 704
705 #undef NOT_A_PATTERN 705 #undef NOT_A_PATTERN
706 } // namespace internal 706 } // namespace internal
707 } // namespace v8 707 } // namespace v8
OLDNEW
« 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