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

Side by Side Diff: src/parser.cc

Issue 1405313002: [es6] Fix scoping for default parameters in arrow functions (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix class literal handling 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 | « src/parameter-initializer-rewriter.cc ('k') | src/pattern-rewriter.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 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"
11 #include "src/base/platform/platform.h" 11 #include "src/base/platform/platform.h"
12 #include "src/bootstrapper.h" 12 #include "src/bootstrapper.h"
13 #include "src/char-predicates-inl.h" 13 #include "src/char-predicates-inl.h"
14 #include "src/codegen.h" 14 #include "src/codegen.h"
15 #include "src/compiler.h" 15 #include "src/compiler.h"
16 #include "src/messages.h" 16 #include "src/messages.h"
17 #include "src/parameter-initializer-rewriter.h"
17 #include "src/preparser.h" 18 #include "src/preparser.h"
18 #include "src/runtime/runtime.h" 19 #include "src/runtime/runtime.h"
19 #include "src/scanner-character-streams.h" 20 #include "src/scanner-character-streams.h"
20 #include "src/scopeinfo.h" 21 #include "src/scopeinfo.h"
21 #include "src/string-stream.h" 22 #include "src/string-stream.h"
22 23
23 namespace v8 { 24 namespace v8 {
24 namespace internal { 25 namespace internal {
25 26
26 ScriptData::ScriptData(const byte* data, int length) 27 ScriptData::ScriptData(const byte* data, int length)
(...skipping 4013 matching lines...) Expand 10 before | Expand all | Expand 10 after
4040 // parse-time side-effect for parameters that are single-names (not 4041 // parse-time side-effect for parameters that are single-names (not
4041 // patterns; for patterns that happens uniformly in 4042 // patterns; for patterns that happens uniformly in
4042 // PatternRewriter::VisitVariableProxy). 4043 // PatternRewriter::VisitVariableProxy).
4043 parser_->scope_->RemoveUnresolved(expr->AsVariableProxy()); 4044 parser_->scope_->RemoveUnresolved(expr->AsVariableProxy());
4044 } else if (expr->IsAssignment()) { 4045 } else if (expr->IsAssignment()) {
4045 Assignment* assignment = expr->AsAssignment(); 4046 Assignment* assignment = expr->AsAssignment();
4046 DCHECK(parser_->allow_harmony_default_parameters()); 4047 DCHECK(parser_->allow_harmony_default_parameters());
4047 DCHECK(!assignment->is_compound()); 4048 DCHECK(!assignment->is_compound());
4048 initializer = assignment->value(); 4049 initializer = assignment->value();
4049 expr = assignment->target(); 4050 expr = assignment->target();
4051
4052 // TODO(adamk): Only call this if necessary.
4053 RewriteParameterInitializerScope(parser_->stack_limit(), initializer,
4054 parser_->scope_, parameters->scope);
4050 } 4055 }
4051 4056
4052 AddFormalParameter(parameters, expr, initializer, is_rest); 4057 AddFormalParameter(parameters, expr, initializer, is_rest);
4053 } 4058 }
4054 4059
4055 4060
4056 void ParserTraits::ParseArrowFunctionFormalParameterList( 4061 void ParserTraits::ParseArrowFunctionFormalParameterList(
4057 ParserFormalParameters* parameters, Expression* expr, 4062 ParserFormalParameters* parameters, Expression* expr,
4058 const Scanner::Location& params_loc, 4063 const Scanner::Location& params_loc,
4059 Scanner::Location* duplicate_loc, bool* ok) { 4064 Scanner::Location* duplicate_loc, bool* ok) {
(...skipping 2301 matching lines...) Expand 10 before | Expand all | Expand 10 after
6361 6366
6362 Expression* Parser::SpreadCallNew(Expression* function, 6367 Expression* Parser::SpreadCallNew(Expression* function,
6363 ZoneList<v8::internal::Expression*>* args, 6368 ZoneList<v8::internal::Expression*>* args,
6364 int pos) { 6369 int pos) {
6365 args->InsertAt(0, function, zone()); 6370 args->InsertAt(0, function, zone());
6366 6371
6367 return factory()->NewCallRuntime(Context::REFLECT_CONSTRUCT_INDEX, args, pos); 6372 return factory()->NewCallRuntime(Context::REFLECT_CONSTRUCT_INDEX, args, pos);
6368 } 6373 }
6369 } // namespace internal 6374 } // namespace internal
6370 } // namespace v8 6375 } // namespace v8
OLDNEW
« no previous file with comments | « src/parameter-initializer-rewriter.cc ('k') | src/pattern-rewriter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698