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 3576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3587 if (num_decl != 1) { | 3587 if (num_decl != 1) { |
3588 const char* loop_type = | 3588 const char* loop_type = |
3589 mode == ForEachStatement::ITERATE ? "for-of" : "for-in"; | 3589 mode == ForEachStatement::ITERATE ? "for-of" : "for-in"; |
3590 ParserTraits::ReportMessageAt( | 3590 ParserTraits::ReportMessageAt( |
3591 parsing_result.bindings_loc, | 3591 parsing_result.bindings_loc, |
3592 MessageTemplate::kForInOfLoopMultiBindings, loop_type); | 3592 MessageTemplate::kForInOfLoopMultiBindings, loop_type); |
3593 *ok = false; | 3593 *ok = false; |
3594 return nullptr; | 3594 return nullptr; |
3595 } | 3595 } |
3596 if (parsing_result.first_initializer_loc.IsValid() && | 3596 if (parsing_result.first_initializer_loc.IsValid() && |
3597 (is_strict(language_mode()) || mode == ForEachStatement::ITERATE)) { | 3597 (is_strict(language_mode()) || mode == ForEachStatement::ITERATE || |
| 3598 IsLexicalVariableMode(parsing_result.descriptor.mode))) { |
3598 if (mode == ForEachStatement::ITERATE) { | 3599 if (mode == ForEachStatement::ITERATE) { |
3599 ReportMessageAt(parsing_result.first_initializer_loc, | 3600 ReportMessageAt(parsing_result.first_initializer_loc, |
3600 MessageTemplate::kForOfLoopInitializer); | 3601 MessageTemplate::kForOfLoopInitializer); |
3601 } else { | 3602 } else { |
3602 // TODO(caitp): This should be an error in sloppy mode too. | 3603 // TODO(caitp): This should be an error in sloppy mode too. |
3603 ReportMessageAt(parsing_result.first_initializer_loc, | 3604 ReportMessageAt(parsing_result.first_initializer_loc, |
3604 MessageTemplate::kForInLoopInitializer); | 3605 MessageTemplate::kForInLoopInitializer); |
3605 } | 3606 } |
3606 *ok = false; | 3607 *ok = false; |
3607 return nullptr; | 3608 return nullptr; |
(...skipping 2505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6113 | 6114 |
6114 Expression* Parser::SpreadCallNew(Expression* function, | 6115 Expression* Parser::SpreadCallNew(Expression* function, |
6115 ZoneList<v8::internal::Expression*>* args, | 6116 ZoneList<v8::internal::Expression*>* args, |
6116 int pos) { | 6117 int pos) { |
6117 args->InsertAt(0, function, zone()); | 6118 args->InsertAt(0, function, zone()); |
6118 | 6119 |
6119 return factory()->NewCallRuntime(Context::REFLECT_CONSTRUCT_INDEX, args, pos); | 6120 return factory()->NewCallRuntime(Context::REFLECT_CONSTRUCT_INDEX, args, pos); |
6120 } | 6121 } |
6121 } // namespace internal | 6122 } // namespace internal |
6122 } // namespace v8 | 6123 } // namespace v8 |
OLD | NEW |