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

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

Issue 2562443003: [parsing] Fix maybe-assigned flag in some cases. (Closed)
Patch Set: rebase again??? Created 4 years 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') | test/cctest/test-parsing.cc » ('j') | 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 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 Runtime::kInitializeVarGlobal, arguments, value->position()); 212 Runtime::kInitializeVarGlobal, arguments, value->position());
213 block_->statements()->Add( 213 block_->statements()->Add(
214 factory()->NewExpressionStatement(initialize, initialize->position()), 214 factory()->NewExpressionStatement(initialize, initialize->position()),
215 zone()); 215 zone());
216 } else { 216 } else {
217 // For 'let' and 'const' declared variables the initialization always 217 // For 'let' and 'const' declared variables the initialization always
218 // assigns to the declared variable. 218 // assigns to the declared variable.
219 // But for var declarations we need to do a new lookup. 219 // But for var declarations we need to do a new lookup.
220 if (descriptor_->mode == VAR) { 220 if (descriptor_->mode == VAR) {
221 proxy = var_init_scope->NewUnresolved(factory(), name); 221 proxy = var_init_scope->NewUnresolved(factory(), name);
222 // TODO(neis): Set is_assigned on proxy.
222 } else { 223 } else {
223 DCHECK_NOT_NULL(proxy); 224 DCHECK_NOT_NULL(proxy);
224 DCHECK_NOT_NULL(proxy->var()); 225 DCHECK_NOT_NULL(proxy->var());
225 } 226 }
226 // Add break location for destructured sub-pattern. 227 // Add break location for destructured sub-pattern.
227 int pos = IsSubPattern() ? pattern->position() : value->position(); 228 int pos = IsSubPattern() ? pattern->position() : value->position();
228 Assignment* assignment = 229 Assignment* assignment =
229 factory()->NewAssignment(Token::INIT, proxy, value, pos); 230 factory()->NewAssignment(Token::INIT, proxy, value, pos);
230 block_->statements()->Add( 231 block_->statements()->Add(
231 factory()->NewExpressionStatement(assignment, pos), zone()); 232 factory()->NewExpressionStatement(assignment, pos), zone());
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
690 NOT_A_PATTERN(TryFinallyStatement) 691 NOT_A_PATTERN(TryFinallyStatement)
691 NOT_A_PATTERN(UnaryOperation) 692 NOT_A_PATTERN(UnaryOperation)
692 NOT_A_PATTERN(VariableDeclaration) 693 NOT_A_PATTERN(VariableDeclaration)
693 NOT_A_PATTERN(WhileStatement) 694 NOT_A_PATTERN(WhileStatement)
694 NOT_A_PATTERN(WithStatement) 695 NOT_A_PATTERN(WithStatement)
695 NOT_A_PATTERN(Yield) 696 NOT_A_PATTERN(Yield)
696 697
697 #undef NOT_A_PATTERN 698 #undef NOT_A_PATTERN
698 } // namespace internal 699 } // namespace internal
699 } // namespace v8 700 } // namespace v8
OLDNEW
« no previous file with comments | « src/parsing/parser.cc ('k') | test/cctest/test-parsing.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698