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

Side by Side Diff: src/parsing/parser.cc

Issue 2077283004: Rewrite scopes of non-simple default arguments (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix whitespace Created 4 years, 6 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
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/parsing/parser.h" 5 #include "src/parsing/parser.h"
6 6
7 #include "src/api.h" 7 #include "src/api.h"
8 #include "src/ast/ast.h" 8 #include "src/ast/ast.h"
9 #include "src/ast/ast-expression-rewriter.h" 9 #include "src/ast/ast-expression-rewriter.h"
10 #include "src/ast/ast-expression-visitor.h" 10 #include "src/ast/ast-expression-visitor.h"
(...skipping 4595 matching lines...) Expand 10 before | Expand all | Expand 10 after
4606 Block* param_block = init_block; 4606 Block* param_block = init_block;
4607 if (!parameter.is_simple() && scope_->calls_sloppy_eval()) { 4607 if (!parameter.is_simple() && scope_->calls_sloppy_eval()) {
4608 param_scope = NewScope(scope_, BLOCK_SCOPE); 4608 param_scope = NewScope(scope_, BLOCK_SCOPE);
4609 param_scope->set_is_declaration_scope(); 4609 param_scope->set_is_declaration_scope();
4610 param_scope->set_start_position(descriptor.initialization_pos); 4610 param_scope->set_start_position(descriptor.initialization_pos);
4611 param_scope->set_end_position(parameter.initializer_end_position); 4611 param_scope->set_end_position(parameter.initializer_end_position);
4612 param_scope->RecordEvalCall(); 4612 param_scope->RecordEvalCall();
4613 param_block = factory()->NewBlock(NULL, 8, true, RelocInfo::kNoPosition); 4613 param_block = factory()->NewBlock(NULL, 8, true, RelocInfo::kNoPosition);
4614 param_block->set_scope(param_scope); 4614 param_block->set_scope(param_scope);
4615 descriptor.hoist_scope = scope_; 4615 descriptor.hoist_scope = scope_;
4616 // Pass the appropriate scope in so that PatternRewriter can appropriately
4617 // rewrite inner initializers of the pattern to param_scope
4618 descriptor.scope = param_scope;
4619 // Rewrite the outer initializer to point to param_scope
4620 RewriteParameterInitializerScope(stack_limit(), initial_value, scope_,
4621 param_scope);
4616 } 4622 }
4617 4623
4618 { 4624 {
4619 BlockState block_state(&scope_, param_scope); 4625 BlockState block_state(&scope_, param_scope);
4620 DeclarationParsingResult::Declaration decl( 4626 DeclarationParsingResult::Declaration decl(
4621 parameter.pattern, initializer_position, initial_value); 4627 parameter.pattern, initializer_position, initial_value);
4622 PatternRewriter::DeclareAndInitializeVariables(param_block, &descriptor, 4628 PatternRewriter::DeclareAndInitializeVariables(param_block, &descriptor,
4623 &decl, nullptr, CHECK_OK); 4629 &decl, nullptr, CHECK_OK);
4624 } 4630 }
4625 4631
(...skipping 2352 matching lines...) Expand 10 before | Expand all | Expand 10 after
6978 try_block, target); 6984 try_block, target);
6979 final_loop = target; 6985 final_loop = target;
6980 } 6986 }
6981 6987
6982 return final_loop; 6988 return final_loop;
6983 } 6989 }
6984 6990
6985 6991
6986 } // namespace internal 6992 } // namespace internal
6987 } // namespace v8 6993 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698