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