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

Side by Side Diff: src/parser.cc

Issue 1385913003: Fix legacy const for-of/in destructuring (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rephrasing suggested by Adam Created 5 years, 2 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 | « no previous file | src/pattern-rewriter.cc » ('j') | src/pattern-rewriter.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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/parser.h" 5 #include "src/parser.h"
6 6
7 #include "src/api.h" 7 #include "src/api.h"
8 #include "src/ast.h" 8 #include "src/ast.h"
9 #include "src/ast-literal-reindexer.h" 9 #include "src/ast-literal-reindexer.h"
10 #include "src/bailout-reason.h" 10 #include "src/bailout-reason.h"
(...skipping 2535 matching lines...) Expand 10 before | Expand all | Expand 10 after
2546 const AstRawString* single_name = 2546 const AstRawString* single_name =
2547 pattern->IsVariableProxy() ? pattern->AsVariableProxy()->raw_name() 2547 pattern->IsVariableProxy() ? pattern->AsVariableProxy()->raw_name()
2548 : nullptr; 2548 : nullptr;
2549 if (single_name != nullptr) { 2549 if (single_name != nullptr) {
2550 if (fni_ != NULL) fni_->PushVariableName(single_name); 2550 if (fni_ != NULL) fni_->PushVariableName(single_name);
2551 } 2551 }
2552 2552
2553 is_for_iteration_variable = 2553 is_for_iteration_variable =
2554 var_context == kForStatement && 2554 var_context == kForStatement &&
2555 (peek() == Token::IN || PeekContextualKeyword(CStrVector("of"))); 2555 (peek() == Token::IN || PeekContextualKeyword(CStrVector("of")));
2556 if (is_for_iteration_variable && parsing_result->descriptor.mode == CONST) { 2556 if (is_for_iteration_variable &&
2557 (parsing_result->descriptor.mode == CONST ||
2558 parsing_result->descriptor.mode == CONST_LEGACY)) {
2557 parsing_result->descriptor.needs_init = false; 2559 parsing_result->descriptor.needs_init = false;
2558 } 2560 }
2559 2561
2560 Expression* value = NULL; 2562 Expression* value = NULL;
2561 // Harmony consts have non-optional initializers. 2563 // Harmony consts have non-optional initializers.
2562 int initializer_position = RelocInfo::kNoPosition; 2564 int initializer_position = RelocInfo::kNoPosition;
2563 if (peek() == Token::ASSIGN || (parsing_result->descriptor.mode == CONST && 2565 if (peek() == Token::ASSIGN || (parsing_result->descriptor.mode == CONST &&
2564 !is_for_iteration_variable)) { 2566 !is_for_iteration_variable)) {
2565 Expect(Token::ASSIGN, ok); 2567 Expect(Token::ASSIGN, ok);
2566 if (!*ok) return; 2568 if (!*ok) return;
(...skipping 3752 matching lines...) Expand 10 before | Expand all | Expand 10 after
6319 6321
6320 Expression* Parser::SpreadCallNew(Expression* function, 6322 Expression* Parser::SpreadCallNew(Expression* function,
6321 ZoneList<v8::internal::Expression*>* args, 6323 ZoneList<v8::internal::Expression*>* args,
6322 int pos) { 6324 int pos) {
6323 args->InsertAt(0, function, zone()); 6325 args->InsertAt(0, function, zone());
6324 6326
6325 return factory()->NewCallRuntime(Context::REFLECT_CONSTRUCT_INDEX, args, pos); 6327 return factory()->NewCallRuntime(Context::REFLECT_CONSTRUCT_INDEX, args, pos);
6326 } 6328 }
6327 } // namespace internal 6329 } // namespace internal
6328 } // namespace v8 6330 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/pattern-rewriter.cc » ('j') | src/pattern-rewriter.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698