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 3847 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3858 formal_parameters.materialized_literals_count); | 3858 formal_parameters.materialized_literals_count); |
3859 | 3859 |
3860 impl()->ReindexLiterals(formal_parameters); | 3860 impl()->ReindexLiterals(formal_parameters); |
3861 | 3861 |
3862 Expect(Token::ARROW, CHECK_OK); | 3862 Expect(Token::ARROW, CHECK_OK); |
3863 | 3863 |
3864 if (peek() == Token::LBRACE) { | 3864 if (peek() == Token::LBRACE) { |
3865 // Multiple statement body | 3865 // Multiple statement body |
3866 Consume(Token::LBRACE); | 3866 Consume(Token::LBRACE); |
3867 DCHECK_EQ(scope(), formal_parameters.scope); | 3867 DCHECK_EQ(scope(), formal_parameters.scope); |
3868 bool is_lazily_parsed = (mode() == PARSE_LAZILY && | 3868 bool is_lazily_parsed = |
3869 formal_parameters.scope->AllowsLazyParsing()); | 3869 (mode() == PARSE_LAZILY && |
| 3870 formal_parameters.scope |
| 3871 ->AllowsLazyParsingWithoutUnresolvedVariables()); |
| 3872 // TODO(marja): consider lazy-parsing inner arrow functions too. |
3870 if (is_lazily_parsed) { | 3873 if (is_lazily_parsed) { |
3871 Scanner::BookmarkScope bookmark(scanner()); | 3874 Scanner::BookmarkScope bookmark(scanner()); |
3872 bool may_abort = bookmark.Set(); | 3875 bool may_abort = bookmark.Set(); |
3873 LazyParsingResult result = impl()->SkipLazyFunctionBody( | 3876 LazyParsingResult result = impl()->SkipLazyFunctionBody( |
3874 &materialized_literal_count, &expected_property_count, may_abort, | 3877 &materialized_literal_count, &expected_property_count, false, |
3875 CHECK_OK); | 3878 may_abort, CHECK_OK); |
3876 | 3879 |
3877 if (formal_parameters.materialized_literals_count > 0) { | 3880 if (formal_parameters.materialized_literals_count > 0) { |
3878 materialized_literal_count += | 3881 materialized_literal_count += |
3879 formal_parameters.materialized_literals_count; | 3882 formal_parameters.materialized_literals_count; |
3880 } | 3883 } |
3881 | 3884 |
3882 if (result == kLazyParsingAborted) { | 3885 if (result == kLazyParsingAborted) { |
3883 bookmark.Reset(); | 3886 bookmark.Reset(); |
3884 // Trigger eager (re-)parsing, just below this block. | 3887 // Trigger eager (re-)parsing, just below this block. |
3885 is_lazily_parsed = false; | 3888 is_lazily_parsed = false; |
(...skipping 1013 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4899 has_seen_constructor_ = true; | 4902 has_seen_constructor_ = true; |
4900 return; | 4903 return; |
4901 } | 4904 } |
4902 } | 4905 } |
4903 | 4906 |
4904 | 4907 |
4905 } // namespace internal | 4908 } // namespace internal |
4906 } // namespace v8 | 4909 } // namespace v8 |
4907 | 4910 |
4908 #endif // V8_PARSING_PARSER_BASE_H | 4911 #endif // V8_PARSING_PARSER_BASE_H |
OLD | NEW |