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 3583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3594 if (num_decl != 1) { | 3594 if (num_decl != 1) { |
3595 const char* loop_type = | 3595 const char* loop_type = |
3596 mode == ForEachStatement::ITERATE ? "for-of" : "for-in"; | 3596 mode == ForEachStatement::ITERATE ? "for-of" : "for-in"; |
3597 ParserTraits::ReportMessageAt( | 3597 ParserTraits::ReportMessageAt( |
3598 parsing_result.bindings_loc, | 3598 parsing_result.bindings_loc, |
3599 MessageTemplate::kForInOfLoopMultiBindings, loop_type); | 3599 MessageTemplate::kForInOfLoopMultiBindings, loop_type); |
3600 *ok = false; | 3600 *ok = false; |
3601 return nullptr; | 3601 return nullptr; |
3602 } | 3602 } |
3603 if (parsing_result.first_initializer_loc.IsValid() && | 3603 if (parsing_result.first_initializer_loc.IsValid() && |
3604 (is_strict(language_mode()) || mode == ForEachStatement::ITERATE)) { | 3604 (is_strict(language_mode()) || mode == ForEachStatement::ITERATE || |
| 3605 IsLexicalVariableMode(parsing_result.descriptor.mode))) { |
3605 if (mode == ForEachStatement::ITERATE) { | 3606 if (mode == ForEachStatement::ITERATE) { |
3606 ReportMessageAt(parsing_result.first_initializer_loc, | 3607 ReportMessageAt(parsing_result.first_initializer_loc, |
3607 MessageTemplate::kForOfLoopInitializer); | 3608 MessageTemplate::kForOfLoopInitializer); |
3608 } else { | 3609 } else { |
3609 // TODO(caitp): This should be an error in sloppy mode too. | 3610 // TODO(caitp): This should be an error in sloppy mode too. |
3610 ReportMessageAt(parsing_result.first_initializer_loc, | 3611 ReportMessageAt(parsing_result.first_initializer_loc, |
3611 MessageTemplate::kForInLoopInitializer); | 3612 MessageTemplate::kForInLoopInitializer); |
3612 } | 3613 } |
3613 *ok = false; | 3614 *ok = false; |
3614 return nullptr; | 3615 return nullptr; |
(...skipping 2505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6120 | 6121 |
6121 Expression* Parser::SpreadCallNew(Expression* function, | 6122 Expression* Parser::SpreadCallNew(Expression* function, |
6122 ZoneList<v8::internal::Expression*>* args, | 6123 ZoneList<v8::internal::Expression*>* args, |
6123 int pos) { | 6124 int pos) { |
6124 args->InsertAt(0, function, zone()); | 6125 args->InsertAt(0, function, zone()); |
6125 | 6126 |
6126 return factory()->NewCallRuntime(Context::REFLECT_CONSTRUCT_INDEX, args, pos); | 6127 return factory()->NewCallRuntime(Context::REFLECT_CONSTRUCT_INDEX, args, pos); |
6127 } | 6128 } |
6128 } // namespace internal | 6129 } // namespace internal |
6129 } // namespace v8 | 6130 } // namespace v8 |
OLD | NEW |