OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |