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_BASE_H | 5 #ifndef V8_PARSING_PARSER_BASE_H |
6 #define V8_PARSING_PARSER_BASE_H | 6 #define V8_PARSING_PARSER_BASE_H |
7 | 7 |
8 #include "src/ast/ast.h" | 8 #include "src/ast/ast.h" |
9 #include "src/ast/scopes.h" | 9 #include "src/ast/scopes.h" |
10 #include "src/bailout-reason.h" | 10 #include "src/bailout-reason.h" |
(...skipping 5642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5653 } | 5653 } |
5654 Expect(Token::RPAREN, CHECK_OK); | 5654 Expect(Token::RPAREN, CHECK_OK); |
5655 | 5655 |
5656 body = ParseScopedStatement(nullptr, true, CHECK_OK); | 5656 body = ParseScopedStatement(nullptr, true, CHECK_OK); |
5657 } | 5657 } |
5658 | 5658 |
5659 if (bound_names_are_lexical && for_info->bound_names.length() > 0) { | 5659 if (bound_names_are_lexical && for_info->bound_names.length() > 0) { |
5660 auto result = impl()->DesugarLexicalBindingsInForStatement( | 5660 auto result = impl()->DesugarLexicalBindingsInForStatement( |
5661 loop, init, cond, next, body, inner_scope, *for_info, CHECK_OK); | 5661 loop, init, cond, next, body, inner_scope, *for_info, CHECK_OK); |
5662 for_state->set_end_position(scanner()->location().end_pos); | 5662 for_state->set_end_position(scanner()->location().end_pos); |
| 5663 inner_scope->set_end_position(scanner()->location().end_pos); |
5663 return result; | 5664 return result; |
5664 } | 5665 } |
5665 | 5666 |
5666 for_state->set_end_position(scanner()->location().end_pos); | 5667 for_state->set_end_position(scanner()->location().end_pos); |
5667 Scope* for_scope = for_state->FinalizedBlockScope(); | 5668 Scope* for_scope = for_state->FinalizedBlockScope(); |
5668 if (for_scope != nullptr) { | 5669 if (for_scope != nullptr) { |
5669 // Rewrite a for statement of the form | 5670 // Rewrite a for statement of the form |
5670 // for (const x = i; c; n) b | 5671 // for (const x = i; c; n) b |
5671 // | 5672 // |
5672 // into | 5673 // into |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5750 return; | 5751 return; |
5751 } | 5752 } |
5752 } | 5753 } |
5753 | 5754 |
5754 #undef CHECK_OK_VOID | 5755 #undef CHECK_OK_VOID |
5755 | 5756 |
5756 } // namespace internal | 5757 } // namespace internal |
5757 } // namespace v8 | 5758 } // namespace v8 |
5758 | 5759 |
5759 #endif // V8_PARSING_PARSER_BASE_H | 5760 #endif // V8_PARSING_PARSER_BASE_H |
OLD | NEW |