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 = | 3918 bool is_lazily_parsed = (mode() == PARSE_LAZILY && |
3919 (mode() == PARSE_LAZILY && | 3919 formal_parameters.scope->AllowsLazyParsing()); |
3920 formal_parameters.scope | |
3921 ->AllowsLazyParsingWithoutUnresolvedVariables()); | |
3922 // TODO(marja): consider lazy-parsing inner arrow functions too. is_this | |
3923 // handling in Scope::ResolveVariable needs to change. | |
3924 if (is_lazily_parsed) { | 3920 if (is_lazily_parsed) { |
3925 Scanner::BookmarkScope bookmark(scanner()); | 3921 Scanner::BookmarkScope bookmark(scanner()); |
3926 bookmark.Set(); | 3922 bookmark.Set(); |
3927 LazyParsingResult result = impl()->SkipLazyFunctionBody( | 3923 LazyParsingResult result = impl()->SkipLazyFunctionBody( |
3928 &materialized_literal_count, &expected_property_count, false, true, | 3924 &materialized_literal_count, &expected_property_count, true, |
3929 CHECK_OK); | 3925 CHECK_OK); |
3930 | 3926 |
3931 if (formal_parameters.materialized_literals_count > 0) { | 3927 if (formal_parameters.materialized_literals_count > 0) { |
3932 materialized_literal_count += | 3928 materialized_literal_count += |
3933 formal_parameters.materialized_literals_count; | 3929 formal_parameters.materialized_literals_count; |
3934 } | 3930 } |
3935 | 3931 |
3936 if (result == kLazyParsingAborted) { | 3932 if (result == kLazyParsingAborted) { |
3937 bookmark.Apply(); | 3933 bookmark.Apply(); |
3938 // Trigger eager (re-)parsing, just below this block. | 3934 // Trigger eager (re-)parsing, just below this block. |
(...skipping 1382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5321 has_seen_constructor_ = true; | 5317 has_seen_constructor_ = true; |
5322 return; | 5318 return; |
5323 } | 5319 } |
5324 } | 5320 } |
5325 | 5321 |
5326 | 5322 |
5327 } // namespace internal | 5323 } // namespace internal |
5328 } // namespace v8 | 5324 } // namespace v8 |
5329 | 5325 |
5330 #endif // V8_PARSING_PARSER_BASE_H | 5326 #endif // V8_PARSING_PARSER_BASE_H |
OLD | NEW |