| 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/ast-literal-reindexer.h" | 9 #include "src/ast-literal-reindexer.h" |
| 10 #include "src/bailout-reason.h" | 10 #include "src/bailout-reason.h" |
| (...skipping 1044 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1055 } else { | 1055 } else { |
| 1056 ParseStatementList(body, Token::EOS, &ok); | 1056 ParseStatementList(body, Token::EOS, &ok); |
| 1057 } | 1057 } |
| 1058 | 1058 |
| 1059 // The parser will peek but not consume EOS. Our scope logically goes all | 1059 // The parser will peek but not consume EOS. Our scope logically goes all |
| 1060 // the way to the EOS, though. | 1060 // the way to the EOS, though. |
| 1061 scope->set_end_position(scanner()->peek_location().beg_pos); | 1061 scope->set_end_position(scanner()->peek_location().beg_pos); |
| 1062 | 1062 |
| 1063 if (ok && is_strict(language_mode())) { | 1063 if (ok && is_strict(language_mode())) { |
| 1064 CheckStrictOctalLiteral(beg_pos, scanner()->location().end_pos, &ok); | 1064 CheckStrictOctalLiteral(beg_pos, scanner()->location().end_pos, &ok); |
| 1065 } |
| 1066 if (ok && (is_strict(language_mode()) || allow_harmony_sloppy())) { |
| 1065 CheckConflictingVarDeclarations(scope_, &ok); | 1067 CheckConflictingVarDeclarations(scope_, &ok); |
| 1066 } | 1068 } |
| 1067 | 1069 |
| 1068 if (ok && info->parse_restriction() == ONLY_SINGLE_FUNCTION_LITERAL) { | 1070 if (ok && info->parse_restriction() == ONLY_SINGLE_FUNCTION_LITERAL) { |
| 1069 if (body->length() != 1 || | 1071 if (body->length() != 1 || |
| 1070 !body->at(0)->IsExpressionStatement() || | 1072 !body->at(0)->IsExpressionStatement() || |
| 1071 !body->at(0)->AsExpressionStatement()-> | 1073 !body->at(0)->AsExpressionStatement()-> |
| 1072 expression()->IsFunctionLiteral()) { | 1074 expression()->IsFunctionLiteral()) { |
| 1073 ReportMessage(MessageTemplate::kSingleFunctionLiteral); | 1075 ReportMessage(MessageTemplate::kSingleFunctionLiteral); |
| 1074 ok = false; | 1076 ok = false; |
| (...skipping 3059 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4134 const bool use_strict_params = | 4136 const bool use_strict_params = |
| 4135 !parsing_state.is_simple_parameter_list || IsConciseMethod(kind); | 4137 !parsing_state.is_simple_parameter_list || IsConciseMethod(kind); |
| 4136 const bool allow_duplicate_parameters = | 4138 const bool allow_duplicate_parameters = |
| 4137 is_sloppy(language_mode()) && !use_strict_params; | 4139 is_sloppy(language_mode()) && !use_strict_params; |
| 4138 ValidateFormalParameters(&formals_classifier, language_mode(), | 4140 ValidateFormalParameters(&formals_classifier, language_mode(), |
| 4139 allow_duplicate_parameters, CHECK_OK); | 4141 allow_duplicate_parameters, CHECK_OK); |
| 4140 | 4142 |
| 4141 if (is_strict(language_mode())) { | 4143 if (is_strict(language_mode())) { |
| 4142 CheckStrictOctalLiteral(scope->start_position(), scope->end_position(), | 4144 CheckStrictOctalLiteral(scope->start_position(), scope->end_position(), |
| 4143 CHECK_OK); | 4145 CHECK_OK); |
| 4146 } |
| 4147 if (is_strict(language_mode()) || allow_harmony_sloppy()) { |
| 4144 CheckConflictingVarDeclarations(scope, CHECK_OK); | 4148 CheckConflictingVarDeclarations(scope, CHECK_OK); |
| 4145 } | 4149 } |
| 4146 } | 4150 } |
| 4147 | 4151 |
| 4148 bool has_duplicate_parameters = | 4152 bool has_duplicate_parameters = |
| 4149 !formals_classifier.is_valid_formal_parameter_list_without_duplicates(); | 4153 !formals_classifier.is_valid_formal_parameter_list_without_duplicates(); |
| 4150 FunctionLiteral::ParameterFlag duplicate_parameters = | 4154 FunctionLiteral::ParameterFlag duplicate_parameters = |
| 4151 has_duplicate_parameters ? FunctionLiteral::kHasDuplicateParameters | 4155 has_duplicate_parameters ? FunctionLiteral::kHasDuplicateParameters |
| 4152 : FunctionLiteral::kNoDuplicateParameters; | 4156 : FunctionLiteral::kNoDuplicateParameters; |
| 4153 | 4157 |
| (...skipping 1790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5944 Expression* Parser::SpreadCallNew(Expression* function, | 5948 Expression* Parser::SpreadCallNew(Expression* function, |
| 5945 ZoneList<v8::internal::Expression*>* args, | 5949 ZoneList<v8::internal::Expression*>* args, |
| 5946 int pos) { | 5950 int pos) { |
| 5947 args->InsertAt(0, function, zone()); | 5951 args->InsertAt(0, function, zone()); |
| 5948 | 5952 |
| 5949 return factory()->NewCallRuntime( | 5953 return factory()->NewCallRuntime( |
| 5950 ast_value_factory()->reflect_construct_string(), NULL, args, pos); | 5954 ast_value_factory()->reflect_construct_string(), NULL, args, pos); |
| 5951 } | 5955 } |
| 5952 } // namespace internal | 5956 } // namespace internal |
| 5953 } // namespace v8 | 5957 } // namespace v8 |
| OLD | NEW |