| 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/v8.h" | 5 #include "src/v8.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/bailout-reason.h" | 9 #include "src/bailout-reason.h" |
| 10 #include "src/base/platform/platform.h" | 10 #include "src/base/platform/platform.h" |
| (...skipping 3787 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3798 const AstRawString* raw_name = expr->AsVariableProxy()->raw_name(); | 3798 const AstRawString* raw_name = expr->AsVariableProxy()->raw_name(); |
| 3799 Scanner::Location param_location(expr->position(), | 3799 Scanner::Location param_location(expr->position(), |
| 3800 expr->position() + raw_name->length()); | 3800 expr->position() + raw_name->length()); |
| 3801 | 3801 |
| 3802 // When the formal parameter was originally seen, it was parsed as a | 3802 // When the formal parameter was originally seen, it was parsed as a |
| 3803 // VariableProxy and recorded as unresolved in the scope. Here we undo that | 3803 // VariableProxy and recorded as unresolved in the scope. Here we undo that |
| 3804 // parse-time side-effect. | 3804 // parse-time side-effect. |
| 3805 parser_->scope_->RemoveUnresolved(expr->AsVariableProxy()); | 3805 parser_->scope_->RemoveUnresolved(expr->AsVariableProxy()); |
| 3806 | 3806 |
| 3807 bool is_rest = false; | 3807 bool is_rest = false; |
| 3808 bool is_duplicate = DeclareFormalParameter(scope, raw_name, is_rest); | 3808 ExpressionClassifier classifier; |
| 3809 | 3809 DeclareFormalParameter(scope, raw_name, &classifier, is_rest); |
| 3810 if (is_duplicate && !duplicate_loc->IsValid()) { | 3810 *duplicate_loc = classifier.duplicate_formal_parameter_error().location; |
| 3811 *duplicate_loc = param_location; | |
| 3812 } | |
| 3813 } | 3811 } |
| 3814 | 3812 |
| 3815 | 3813 |
| 3816 void ParserTraits::ParseArrowFunctionFormalParameters( | 3814 void ParserTraits::ParseArrowFunctionFormalParameters( |
| 3817 Scope* scope, Expression* params, const Scanner::Location& params_loc, | 3815 Scope* scope, Expression* params, const Scanner::Location& params_loc, |
| 3818 bool* is_rest, Scanner::Location* duplicate_loc, bool* ok) { | 3816 bool* is_rest, Scanner::Location* duplicate_loc, bool* ok) { |
| 3819 DeclareArrowFunctionParameters(scope, params, params_loc, duplicate_loc, ok); | 3817 DeclareArrowFunctionParameters(scope, params, params_loc, duplicate_loc, ok); |
| 3820 } | 3818 } |
| 3821 | 3819 |
| 3822 | 3820 |
| (...skipping 1998 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5821 Expression* Parser::SpreadCallNew(Expression* function, | 5819 Expression* Parser::SpreadCallNew(Expression* function, |
| 5822 ZoneList<v8::internal::Expression*>* args, | 5820 ZoneList<v8::internal::Expression*>* args, |
| 5823 int pos) { | 5821 int pos) { |
| 5824 args->InsertAt(0, function, zone()); | 5822 args->InsertAt(0, function, zone()); |
| 5825 | 5823 |
| 5826 return factory()->NewCallRuntime( | 5824 return factory()->NewCallRuntime( |
| 5827 ast_value_factory()->reflect_construct_string(), NULL, args, pos); | 5825 ast_value_factory()->reflect_construct_string(), NULL, args, pos); |
| 5828 } | 5826 } |
| 5829 } // namespace internal | 5827 } // namespace internal |
| 5830 } // namespace v8 | 5828 } // namespace v8 |
| OLD | NEW |