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" |
(...skipping 4130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4141 DCHECK_EQ(parameters->is_simple, parameters->scope->has_simple_parameters()); | 4141 DCHECK_EQ(parameters->is_simple, parameters->scope->has_simple_parameters()); |
4142 } | 4142 } |
4143 | 4143 |
4144 | 4144 |
4145 void ParserTraits::ReindexLiterals(const ParserFormalParameters& parameters) { | 4145 void ParserTraits::ReindexLiterals(const ParserFormalParameters& parameters) { |
4146 if (parser_->function_state_->materialized_literal_count() > 0) { | 4146 if (parser_->function_state_->materialized_literal_count() > 0) { |
4147 AstLiteralReindexer reindexer; | 4147 AstLiteralReindexer reindexer; |
4148 | 4148 |
4149 for (const auto p : parameters.params) { | 4149 for (const auto p : parameters.params) { |
4150 if (p.pattern != nullptr) reindexer.Reindex(p.pattern); | 4150 if (p.pattern != nullptr) reindexer.Reindex(p.pattern); |
| 4151 if (p.initializer != nullptr) reindexer.Reindex(p.initializer); |
4151 } | 4152 } |
4152 | 4153 |
4153 if (parameters.has_rest) { | 4154 if (parameters.has_rest) { |
4154 parameters.rest_array_literal_index = reindexer.NextIndex(); | 4155 parameters.rest_array_literal_index = reindexer.NextIndex(); |
4155 } | 4156 } |
4156 | 4157 |
4157 DCHECK(reindexer.count() <= | 4158 DCHECK(reindexer.count() <= |
4158 parser_->function_state_->materialized_literal_count()); | 4159 parser_->function_state_->materialized_literal_count()); |
4159 } | 4160 } |
4160 } | 4161 } |
(...skipping 2264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6425 } | 6426 } |
6426 | 6427 |
6427 | 6428 |
6428 void Parser::RaiseLanguageMode(LanguageMode mode) { | 6429 void Parser::RaiseLanguageMode(LanguageMode mode) { |
6429 SetLanguageMode(scope_, | 6430 SetLanguageMode(scope_, |
6430 static_cast<LanguageMode>(scope_->language_mode() | mode)); | 6431 static_cast<LanguageMode>(scope_->language_mode() | mode)); |
6431 } | 6432 } |
6432 | 6433 |
6433 } // namespace internal | 6434 } // namespace internal |
6434 } // namespace v8 | 6435 } // namespace v8 |
OLD | NEW |