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

Side by Side Diff: src/parser.cc

Issue 1468143004: [es6] Self-assignment in a default parameter initializer should throw (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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 | « no previous file | test/message/default-parameter-tdz.js » ('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 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 4642 matching lines...) Expand 10 before | Expand all | Expand 10 after
4653 param_scope->set_end_position(RelocInfo::kNoPosition); 4653 param_scope->set_end_position(RelocInfo::kNoPosition);
4654 param_scope->RecordEvalCall(); 4654 param_scope->RecordEvalCall();
4655 param_block = factory()->NewBlock(NULL, 8, true, RelocInfo::kNoPosition); 4655 param_block = factory()->NewBlock(NULL, 8, true, RelocInfo::kNoPosition);
4656 param_block->set_scope(param_scope); 4656 param_block->set_scope(param_scope);
4657 descriptor.hoist_scope = scope_; 4657 descriptor.hoist_scope = scope_;
4658 } 4658 }
4659 4659
4660 { 4660 {
4661 BlockState block_state(&scope_, param_scope); 4661 BlockState block_state(&scope_, param_scope);
4662 DeclarationParsingResult::Declaration decl( 4662 DeclarationParsingResult::Declaration decl(
4663 parameter.pattern, parameter.pattern->position(), initial_value); 4663 parameter.pattern, descriptor.initialization_pos, initial_value);
Dan Ehrenberg 2015/11/24 00:37:35 I think you want the position to be the end of the
adamk 2015/11/24 01:08:51 Great catch. I made the test more complex and adde
4664 PatternRewriter::DeclareAndInitializeVariables(param_block, &descriptor, 4664 PatternRewriter::DeclareAndInitializeVariables(param_block, &descriptor,
4665 &decl, nullptr, CHECK_OK); 4665 &decl, nullptr, CHECK_OK);
4666 } 4666 }
4667 4667
4668 if (!parameter.is_simple() && scope_->calls_sloppy_eval()) { 4668 if (!parameter.is_simple() && scope_->calls_sloppy_eval()) {
4669 param_scope = param_scope->FinalizeBlockScope(); 4669 param_scope = param_scope->FinalizeBlockScope();
4670 if (param_scope != nullptr) { 4670 if (param_scope != nullptr) {
4671 CheckConflictingVarDeclarations(param_scope, CHECK_OK); 4671 CheckConflictingVarDeclarations(param_scope, CHECK_OK);
4672 } 4672 }
4673 init_block->statements()->Add(param_block, zone()); 4673 init_block->statements()->Add(param_block, zone());
(...skipping 1782 matching lines...) Expand 10 before | Expand all | Expand 10 after
6456 } 6456 }
6457 6457
6458 6458
6459 void Parser::RaiseLanguageMode(LanguageMode mode) { 6459 void Parser::RaiseLanguageMode(LanguageMode mode) {
6460 SetLanguageMode(scope_, 6460 SetLanguageMode(scope_,
6461 static_cast<LanguageMode>(scope_->language_mode() | mode)); 6461 static_cast<LanguageMode>(scope_->language_mode() | mode));
6462 } 6462 }
6463 6463
6464 } // namespace internal 6464 } // namespace internal
6465 } // namespace v8 6465 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/message/default-parameter-tdz.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698