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