| 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 1374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1385 } | 1385 } |
| 1386 | 1386 |
| 1387 | 1387 |
| 1388 void ParserTraits::AddFormalParameter(ParserFormalParameters* parameters, | 1388 void ParserTraits::AddFormalParameter(ParserFormalParameters* parameters, |
| 1389 Expression* pattern, | 1389 Expression* pattern, |
| 1390 Expression* initializer, | 1390 Expression* initializer, |
| 1391 int initializer_end_position, | 1391 int initializer_end_position, |
| 1392 bool is_rest) { | 1392 bool is_rest) { |
| 1393 bool is_simple = | 1393 bool is_simple = |
| 1394 !is_rest && pattern->IsVariableProxy() && initializer == nullptr; | 1394 !is_rest && pattern->IsVariableProxy() && initializer == nullptr; |
| 1395 DCHECK(parser_->allow_harmony_destructuring_bind() || | |
| 1396 parser_->allow_harmony_rest_parameters() || | |
| 1397 parser_->allow_harmony_default_parameters() || is_simple); | |
| 1398 const AstRawString* name = is_simple | 1395 const AstRawString* name = is_simple |
| 1399 ? pattern->AsVariableProxy()->raw_name() | 1396 ? pattern->AsVariableProxy()->raw_name() |
| 1400 : parser_->ast_value_factory()->empty_string(); | 1397 : parser_->ast_value_factory()->empty_string(); |
| 1401 parameters->params.Add( | 1398 parameters->params.Add( |
| 1402 ParserFormalParameters::Parameter(name, pattern, initializer, | 1399 ParserFormalParameters::Parameter(name, pattern, initializer, |
| 1403 initializer_end_position, is_rest), | 1400 initializer_end_position, is_rest), |
| 1404 parameters->scope->zone()); | 1401 parameters->scope->zone()); |
| 1405 } | 1402 } |
| 1406 | 1403 |
| 1407 | 1404 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1445 | 1442 |
| 1446 DoExpression* ParserTraits::ParseDoExpression(bool* ok) { | 1443 DoExpression* ParserTraits::ParseDoExpression(bool* ok) { |
| 1447 return parser_->ParseDoExpression(ok); | 1444 return parser_->ParseDoExpression(ok); |
| 1448 } | 1445 } |
| 1449 | 1446 |
| 1450 | 1447 |
| 1451 } // namespace internal | 1448 } // namespace internal |
| 1452 } // namespace v8 | 1449 } // namespace v8 |
| 1453 | 1450 |
| 1454 #endif // V8_PARSING_PARSER_H_ | 1451 #endif // V8_PARSING_PARSER_H_ |
| OLD | NEW |