| 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 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 412 next_materialized_literal_index_ += count; | 412 next_materialized_literal_index_ += count; |
| 413 } | 413 } |
| 414 | 414 |
| 415 void AddProperty() { expected_property_count_++; } | 415 void AddProperty() { expected_property_count_++; } |
| 416 int expected_property_count() { return expected_property_count_; } | 416 int expected_property_count() { return expected_property_count_; } |
| 417 | 417 |
| 418 FunctionKind kind() const { return scope()->function_kind(); } | 418 FunctionKind kind() const { return scope()->function_kind(); } |
| 419 FunctionState* outer() const { return outer_function_state_; } | 419 FunctionState* outer() const { return outer_function_state_; } |
| 420 | 420 |
| 421 void set_generator_object_variable(typename Types::Variable* variable) { | 421 void set_generator_object_variable(typename Types::Variable* variable) { |
| 422 DCHECK(variable != NULL); | 422 DCHECK_NOT_NULL(variable); |
| 423 DCHECK(IsResumableFunction(kind())); | 423 DCHECK(IsResumableFunction(kind())); |
| 424 DCHECK(scope()->has_forced_context_allocation()); |
| 424 generator_object_variable_ = variable; | 425 generator_object_variable_ = variable; |
| 425 } | 426 } |
| 426 typename Types::Variable* generator_object_variable() const { | 427 typename Types::Variable* generator_object_variable() const { |
| 427 return generator_object_variable_; | 428 return generator_object_variable_; |
| 428 } | 429 } |
| 429 | 430 |
| 430 void set_promise_variable(typename Types::Variable* variable) { | 431 void set_promise_variable(typename Types::Variable* variable) { |
| 431 DCHECK(variable != NULL); | 432 DCHECK(variable != NULL); |
| 432 DCHECK(IsAsyncFunction(kind())); | 433 DCHECK(IsAsyncFunction(kind())); |
| 433 promise_variable_ = variable; | 434 promise_variable_ = variable; |
| (...skipping 3731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4165 Expect(Token::RBRACE, CHECK_OK); | 4166 Expect(Token::RBRACE, CHECK_OK); |
| 4166 return impl()->RewriteClassLiteral(name, &class_info, class_token_pos, ok); | 4167 return impl()->RewriteClassLiteral(name, &class_info, class_token_pos, ok); |
| 4167 } | 4168 } |
| 4168 | 4169 |
| 4169 template <typename Impl> | 4170 template <typename Impl> |
| 4170 void ParserBase<Impl>::ParseAsyncFunctionBody(Scope* scope, StatementListT body, | 4171 void ParserBase<Impl>::ParseAsyncFunctionBody(Scope* scope, StatementListT body, |
| 4171 FunctionKind kind, | 4172 FunctionKind kind, |
| 4172 FunctionBodyType body_type, | 4173 FunctionBodyType body_type, |
| 4173 bool accept_IN, int pos, | 4174 bool accept_IN, int pos, |
| 4174 bool* ok) { | 4175 bool* ok) { |
| 4175 scope->ForceContextAllocation(); | |
| 4176 | |
| 4177 impl()->PrepareAsyncFunctionBody(body, kind, pos); | 4176 impl()->PrepareAsyncFunctionBody(body, kind, pos); |
| 4178 | 4177 |
| 4179 BlockT block = factory()->NewBlock(nullptr, 8, true, kNoSourcePosition); | 4178 BlockT block = factory()->NewBlock(nullptr, 8, true, kNoSourcePosition); |
| 4180 | 4179 |
| 4181 ExpressionT return_value = impl()->EmptyExpression(); | 4180 ExpressionT return_value = impl()->EmptyExpression(); |
| 4182 if (body_type == FunctionBodyType::kNormal) { | 4181 if (body_type == FunctionBodyType::kNormal) { |
| 4183 ParseStatementList(block->statements(), Token::RBRACE, | 4182 ParseStatementList(block->statements(), Token::RBRACE, |
| 4184 CHECK_OK_CUSTOM(Void)); | 4183 CHECK_OK_CUSTOM(Void)); |
| 4185 return_value = factory()->NewUndefinedLiteral(kNoSourcePosition); | 4184 return_value = factory()->NewUndefinedLiteral(kNoSourcePosition); |
| 4186 } else { | 4185 } else { |
| (...skipping 1316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5503 has_seen_constructor_ = true; | 5502 has_seen_constructor_ = true; |
| 5504 return; | 5503 return; |
| 5505 } | 5504 } |
| 5506 } | 5505 } |
| 5507 | 5506 |
| 5508 | 5507 |
| 5509 } // namespace internal | 5508 } // namespace internal |
| 5510 } // namespace v8 | 5509 } // namespace v8 |
| 5511 | 5510 |
| 5512 #endif // V8_PARSING_PARSER_BASE_H | 5511 #endif // V8_PARSING_PARSER_BASE_H |
| OLD | NEW |