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

Side by Side Diff: src/parser.cc

Issue 1414283002: [es6] Fix scoping for default parameters in arrow functions (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebased 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/rewriter.h" 19 #include "src/rewriter.h"
19 #include "src/runtime/runtime.h" 20 #include "src/runtime/runtime.h"
20 #include "src/scanner-character-streams.h" 21 #include "src/scanner-character-streams.h"
21 #include "src/scopeinfo.h" 22 #include "src/scopeinfo.h"
22 #include "src/string-stream.h" 23 #include "src/string-stream.h"
23 24
24 namespace v8 { 25 namespace v8 {
25 namespace internal { 26 namespace internal {
26 27
(...skipping 4015 matching lines...) Expand 10 before | Expand all | Expand 10 after
4042 // parse-time side-effect for parameters that are single-names (not 4043 // parse-time side-effect for parameters that are single-names (not
4043 // patterns; for patterns that happens uniformly in 4044 // patterns; for patterns that happens uniformly in
4044 // PatternRewriter::VisitVariableProxy). 4045 // PatternRewriter::VisitVariableProxy).
4045 parser_->scope_->RemoveUnresolved(expr->AsVariableProxy()); 4046 parser_->scope_->RemoveUnresolved(expr->AsVariableProxy());
4046 } else if (expr->IsAssignment()) { 4047 } else if (expr->IsAssignment()) {
4047 Assignment* assignment = expr->AsAssignment(); 4048 Assignment* assignment = expr->AsAssignment();
4048 DCHECK(parser_->allow_harmony_default_parameters()); 4049 DCHECK(parser_->allow_harmony_default_parameters());
4049 DCHECK(!assignment->is_compound()); 4050 DCHECK(!assignment->is_compound());
4050 initializer = assignment->value(); 4051 initializer = assignment->value();
4051 expr = assignment->target(); 4052 expr = assignment->target();
4053
4054 // TODO(adamk): Only call this if necessary.
4055 RewriteParameterInitializerScope(parser_->stack_limit(), initializer,
4056 parser_->scope_, parameters->scope);
4052 } 4057 }
4053 4058
4054 AddFormalParameter(parameters, expr, initializer, is_rest); 4059 AddFormalParameter(parameters, expr, initializer, is_rest);
4055 } 4060 }
4056 4061
4057 4062
4058 DoExpression* Parser::ParseDoExpression(bool* ok) { 4063 DoExpression* Parser::ParseDoExpression(bool* ok) {
4059 // AssignmentExpression :: 4064 // AssignmentExpression ::
4060 // do '{' StatementList '}' 4065 // do '{' StatementList '}'
4061 int pos = peek_position(); 4066 int pos = peek_position();
(...skipping 2320 matching lines...) Expand 10 before | Expand all | Expand 10 after
6382 6387
6383 Expression* Parser::SpreadCallNew(Expression* function, 6388 Expression* Parser::SpreadCallNew(Expression* function,
6384 ZoneList<v8::internal::Expression*>* args, 6389 ZoneList<v8::internal::Expression*>* args,
6385 int pos) { 6390 int pos) {
6386 args->InsertAt(0, function, zone()); 6391 args->InsertAt(0, function, zone());
6387 6392
6388 return factory()->NewCallRuntime(Context::REFLECT_CONSTRUCT_INDEX, args, pos); 6393 return factory()->NewCallRuntime(Context::REFLECT_CONSTRUCT_INDEX, args, pos);
6389 } 6394 }
6390 } // namespace internal 6395 } // namespace internal
6391 } // namespace v8 6396 } // 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