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 3897 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3908 formal_parameters.materialized_literals_count); | 3908 formal_parameters.materialized_literals_count); |
3909 | 3909 |
3910 impl()->ReindexLiterals(formal_parameters); | 3910 impl()->ReindexLiterals(formal_parameters); |
3911 | 3911 |
3912 Expect(Token::ARROW, CHECK_OK); | 3912 Expect(Token::ARROW, CHECK_OK); |
3913 | 3913 |
3914 if (peek() == Token::LBRACE) { | 3914 if (peek() == Token::LBRACE) { |
3915 // Multiple statement body | 3915 // Multiple statement body |
3916 Consume(Token::LBRACE); | 3916 Consume(Token::LBRACE); |
3917 DCHECK_EQ(scope(), formal_parameters.scope); | 3917 DCHECK_EQ(scope(), formal_parameters.scope); |
3918 bool is_lazily_parsed = (mode() == PARSE_LAZILY && | 3918 bool is_lazily_parsed = |
3919 formal_parameters.scope->AllowsLazyParsing()); | 3919 (mode() == PARSE_LAZILY && |
| 3920 formal_parameters.scope |
| 3921 ->AllowsLazyParsingWithoutUnresolvedVariables()); |
| 3922 // TODO(marja): consider lazy-parsing inner arrow functions too. |
3920 if (is_lazily_parsed) { | 3923 if (is_lazily_parsed) { |
3921 Scanner::BookmarkScope bookmark(scanner()); | 3924 Scanner::BookmarkScope bookmark(scanner()); |
3922 bookmark.Set(); | 3925 bookmark.Set(); |
3923 LazyParsingResult result = impl()->SkipLazyFunctionBody( | 3926 LazyParsingResult result = impl()->SkipLazyFunctionBody( |
3924 &materialized_literal_count, &expected_property_count, true, | 3927 &materialized_literal_count, &expected_property_count, false, true, |
3925 CHECK_OK); | 3928 CHECK_OK); |
3926 | 3929 |
3927 if (formal_parameters.materialized_literals_count > 0) { | 3930 if (formal_parameters.materialized_literals_count > 0) { |
3928 materialized_literal_count += | 3931 materialized_literal_count += |
3929 formal_parameters.materialized_literals_count; | 3932 formal_parameters.materialized_literals_count; |
3930 } | 3933 } |
3931 | 3934 |
3932 if (result == kLazyParsingAborted) { | 3935 if (result == kLazyParsingAborted) { |
3933 bookmark.Apply(); | 3936 bookmark.Apply(); |
3934 // Trigger eager (re-)parsing, just below this block. | 3937 // Trigger eager (re-)parsing, just below this block. |
(...skipping 1382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5317 has_seen_constructor_ = true; | 5320 has_seen_constructor_ = true; |
5318 return; | 5321 return; |
5319 } | 5322 } |
5320 } | 5323 } |
5321 | 5324 |
5322 | 5325 |
5323 } // namespace internal | 5326 } // namespace internal |
5324 } // namespace v8 | 5327 } // namespace v8 |
5325 | 5328 |
5326 #endif // V8_PARSING_PARSER_BASE_H | 5329 #endif // V8_PARSING_PARSER_BASE_H |
OLD | NEW |