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 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 kInsideValidBlock, | 374 kInsideValidBlock, |
375 | 375 |
376 // Tail call expressions are not allowed in the following blocks. | 376 // Tail call expressions are not allowed in the following blocks. |
377 kInsideTryBlock, | 377 kInsideTryBlock, |
378 kInsideForInOfBody, | 378 kInsideForInOfBody, |
379 }; | 379 }; |
380 | 380 |
381 class FunctionState final : public ScopeState { | 381 class FunctionState final : public ScopeState { |
382 public: | 382 public: |
383 FunctionState(FunctionState** function_state_stack, | 383 FunctionState(FunctionState** function_state_stack, |
384 ScopeState** scope_stack, Scope* scope, FunctionKind kind); | 384 ScopeState** scope_stack, DeclarationScope* scope, |
| 385 FunctionKind kind); |
385 ~FunctionState(); | 386 ~FunctionState(); |
386 | 387 |
| 388 DeclarationScope* scope() const { |
| 389 return ScopeState::scope()->AsDeclarationScope(); |
| 390 } |
| 391 |
387 int NextMaterializedLiteralIndex() { | 392 int NextMaterializedLiteralIndex() { |
388 return next_materialized_literal_index_++; | 393 return next_materialized_literal_index_++; |
389 } | 394 } |
390 int materialized_literal_count() { | 395 int materialized_literal_count() { |
391 return next_materialized_literal_index_; | 396 return next_materialized_literal_index_; |
392 } | 397 } |
393 | 398 |
394 void SkipMaterializedLiterals(int count) { | 399 void SkipMaterializedLiterals(int count) { |
395 next_materialized_literal_index_ += count; | 400 next_materialized_literal_index_ += count; |
396 } | 401 } |
(...skipping 1045 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1442 bool allow_harmony_restrictive_generators_; | 1447 bool allow_harmony_restrictive_generators_; |
1443 bool allow_harmony_trailing_commas_; | 1448 bool allow_harmony_trailing_commas_; |
1444 bool allow_harmony_class_fields_; | 1449 bool allow_harmony_class_fields_; |
1445 | 1450 |
1446 friend class DiscardableZoneScope; | 1451 friend class DiscardableZoneScope; |
1447 }; | 1452 }; |
1448 | 1453 |
1449 template <typename Impl> | 1454 template <typename Impl> |
1450 ParserBase<Impl>::FunctionState::FunctionState( | 1455 ParserBase<Impl>::FunctionState::FunctionState( |
1451 FunctionState** function_state_stack, ScopeState** scope_stack, | 1456 FunctionState** function_state_stack, ScopeState** scope_stack, |
1452 Scope* scope, FunctionKind kind) | 1457 DeclarationScope* scope, FunctionKind kind) |
1453 : ScopeState(scope_stack, scope), | 1458 : ScopeState(scope_stack, scope), |
1454 next_materialized_literal_index_(0), | 1459 next_materialized_literal_index_(0), |
1455 expected_property_count_(0), | 1460 expected_property_count_(0), |
1456 kind_(kind), | 1461 kind_(kind), |
1457 generator_object_variable_(nullptr), | 1462 generator_object_variable_(nullptr), |
1458 promise_variable_(nullptr), | 1463 promise_variable_(nullptr), |
1459 function_state_stack_(function_state_stack), | 1464 function_state_stack_(function_state_stack), |
1460 outer_function_state_(*function_state_stack), | 1465 outer_function_state_(*function_state_stack), |
1461 destructuring_assignments_to_rewrite_(16, scope->zone()), | 1466 destructuring_assignments_to_rewrite_(16, scope->zone()), |
1462 tail_call_expressions_(scope->zone()), | 1467 tail_call_expressions_(scope->zone()), |
(...skipping 3858 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5321 has_seen_constructor_ = true; | 5326 has_seen_constructor_ = true; |
5322 return; | 5327 return; |
5323 } | 5328 } |
5324 } | 5329 } |
5325 | 5330 |
5326 | 5331 |
5327 } // namespace internal | 5332 } // namespace internal |
5328 } // namespace v8 | 5333 } // namespace v8 |
5329 | 5334 |
5330 #endif // V8_PARSING_PARSER_BASE_H | 5335 #endif // V8_PARSING_PARSER_BASE_H |
OLD | NEW |