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 #ifndef V8_PARSING_PARSER_H_ | 5 #ifndef V8_PARSING_PARSER_H_ |
6 #define V8_PARSING_PARSER_H_ | 6 #define V8_PARSING_PARSER_H_ |
7 | 7 |
8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
9 #include "src/ast/ast.h" | 9 #include "src/ast/ast.h" |
10 #include "src/ast/scopes.h" | 10 #include "src/ast/scopes.h" |
(...skipping 1257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1268 Scope* scope, const ParserFormalParameters::Parameter& parameter, | 1268 Scope* scope, const ParserFormalParameters::Parameter& parameter, |
1269 Type::ExpressionClassifier* classifier) { | 1269 Type::ExpressionClassifier* classifier) { |
1270 bool is_duplicate = false; | 1270 bool is_duplicate = false; |
1271 bool is_simple = classifier->is_simple_parameter_list(); | 1271 bool is_simple = classifier->is_simple_parameter_list(); |
1272 auto name = is_simple || parameter.is_rest | 1272 auto name = is_simple || parameter.is_rest |
1273 ? parameter.name | 1273 ? parameter.name |
1274 : parser_->ast_value_factory()->empty_string(); | 1274 : parser_->ast_value_factory()->empty_string(); |
1275 auto mode = is_simple || parameter.is_rest ? VAR : TEMPORARY; | 1275 auto mode = is_simple || parameter.is_rest ? VAR : TEMPORARY; |
1276 if (!is_simple) scope->SetHasNonSimpleParameters(); | 1276 if (!is_simple) scope->SetHasNonSimpleParameters(); |
1277 bool is_optional = parameter.initializer != nullptr; | 1277 bool is_optional = parameter.initializer != nullptr; |
1278 Variable* var = scope->DeclareParameter( | 1278 Variable* var = |
1279 name, mode, is_optional, parameter.is_rest, &is_duplicate); | 1279 scope->DeclareParameter(name, mode, is_optional, parameter.is_rest, |
| 1280 &is_duplicate, parser_->ast_value_factory()); |
1280 if (is_duplicate) { | 1281 if (is_duplicate) { |
1281 classifier->RecordDuplicateFormalParameterError( | 1282 classifier->RecordDuplicateFormalParameterError( |
1282 parser_->scanner()->location()); | 1283 parser_->scanner()->location()); |
1283 } | 1284 } |
1284 if (is_sloppy(scope->language_mode())) { | 1285 if (is_sloppy(scope->language_mode())) { |
1285 // TODO(sigurds) Mark every parameter as maybe assigned. This is a | 1286 // TODO(sigurds) Mark every parameter as maybe assigned. This is a |
1286 // conservative approximation necessary to account for parameters | 1287 // conservative approximation necessary to account for parameters |
1287 // that are assigned via the arguments array. | 1288 // that are assigned via the arguments array. |
1288 var->set_maybe_assigned(); | 1289 var->set_maybe_assigned(); |
1289 } | 1290 } |
(...skipping 23 matching lines...) Expand all Loading... |
1313 | 1314 |
1314 DoExpression* ParserTraits::ParseDoExpression(bool* ok) { | 1315 DoExpression* ParserTraits::ParseDoExpression(bool* ok) { |
1315 return parser_->ParseDoExpression(ok); | 1316 return parser_->ParseDoExpression(ok); |
1316 } | 1317 } |
1317 | 1318 |
1318 | 1319 |
1319 } // namespace internal | 1320 } // namespace internal |
1320 } // namespace v8 | 1321 } // namespace v8 |
1321 | 1322 |
1322 #endif // V8_PARSING_PARSER_H_ | 1323 #endif // V8_PARSING_PARSER_H_ |
OLD | NEW |