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 3781 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3792 formal_parameters.materialized_literals_count); | 3792 formal_parameters.materialized_literals_count); |
3793 | 3793 |
3794 impl()->ReindexLiterals(formal_parameters); | 3794 impl()->ReindexLiterals(formal_parameters); |
3795 | 3795 |
3796 Expect(Token::ARROW, CHECK_OK); | 3796 Expect(Token::ARROW, CHECK_OK); |
3797 | 3797 |
3798 if (peek() == Token::LBRACE) { | 3798 if (peek() == Token::LBRACE) { |
3799 // Multiple statement body | 3799 // Multiple statement body |
3800 Consume(Token::LBRACE); | 3800 Consume(Token::LBRACE); |
3801 DCHECK_EQ(scope(), formal_parameters.scope); | 3801 DCHECK_EQ(scope(), formal_parameters.scope); |
3802 bool is_lazily_parsed = (mode() == PARSE_LAZILY && | 3802 bool is_lazily_parsed = |
3803 formal_parameters.scope->AllowsLazyParsing()); | 3803 (mode() == PARSE_LAZILY && |
| 3804 formal_parameters.scope |
| 3805 ->AllowsLazyParsingWithoutUnresolvedVariables()); |
| 3806 // TODO(marja): consider lazy-parsing inner arrow functions too. |
3804 if (is_lazily_parsed) { | 3807 if (is_lazily_parsed) { |
3805 Scanner::BookmarkScope bookmark(scanner()); | 3808 Scanner::BookmarkScope bookmark(scanner()); |
3806 bool may_abort = bookmark.Set(); | 3809 bool may_abort = bookmark.Set(); |
3807 LazyParsingResult result = impl()->SkipLazyFunctionBody( | 3810 LazyParsingResult result = impl()->SkipLazyFunctionBody( |
3808 &materialized_literal_count, &expected_property_count, may_abort, | 3811 &materialized_literal_count, &expected_property_count, false, |
3809 CHECK_OK); | 3812 may_abort, CHECK_OK); |
3810 | 3813 |
3811 if (formal_parameters.materialized_literals_count > 0) { | 3814 if (formal_parameters.materialized_literals_count > 0) { |
3812 materialized_literal_count += | 3815 materialized_literal_count += |
3813 formal_parameters.materialized_literals_count; | 3816 formal_parameters.materialized_literals_count; |
3814 } | 3817 } |
3815 | 3818 |
3816 if (result == kLazyParsingAborted) { | 3819 if (result == kLazyParsingAborted) { |
3817 bookmark.Reset(); | 3820 bookmark.Reset(); |
3818 // Trigger eager (re-)parsing, just below this block. | 3821 // Trigger eager (re-)parsing, just below this block. |
3819 is_lazily_parsed = false; | 3822 is_lazily_parsed = false; |
(...skipping 1013 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4833 has_seen_constructor_ = true; | 4836 has_seen_constructor_ = true; |
4834 return; | 4837 return; |
4835 } | 4838 } |
4836 } | 4839 } |
4837 | 4840 |
4838 | 4841 |
4839 } // namespace internal | 4842 } // namespace internal |
4840 } // namespace v8 | 4843 } // namespace v8 |
4841 | 4844 |
4842 #endif // V8_PARSING_PARSER_BASE_H | 4845 #endif // V8_PARSING_PARSER_BASE_H |
OLD | NEW |