| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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_EXPRESSION_CLASSIFIER_H | 5 #ifndef V8_PARSING_EXPRESSION_CLASSIFIER_H |
| 6 #define V8_PARSING_EXPRESSION_CLASSIFIER_H | 6 #define V8_PARSING_EXPRESSION_CLASSIFIER_H |
| 7 | 7 |
| 8 #include "src/messages.h" | 8 #include "src/messages.h" |
| 9 #include "src/parsing/scanner.h" | 9 #include "src/parsing/scanner.h" |
| 10 #include "src/parsing/token.h" | 10 #include "src/parsing/token.h" |
| (...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 reported_errors_->at(reported_errors_end_-1).kind = | 350 reported_errors_->at(reported_errors_end_-1).kind = |
| 351 kArrowFormalParametersProduction; | 351 kArrowFormalParametersProduction; |
| 352 } | 352 } |
| 353 } | 353 } |
| 354 } | 354 } |
| 355 reported_errors_->Rewind(reported_errors_end_); | 355 reported_errors_->Rewind(reported_errors_end_); |
| 356 inner->reported_errors_begin_ = inner->reported_errors_end_ = | 356 inner->reported_errors_begin_ = inner->reported_errors_end_ = |
| 357 reported_errors_end_; | 357 reported_errors_end_; |
| 358 } | 358 } |
| 359 | 359 |
| 360 // Accumulate errors that can be arbitrarily deep in an expression. | |
| 361 // These correspond to the ECMAScript spec's 'Contains' operation | |
| 362 // on productions. This includes: | |
| 363 // | |
| 364 // - YieldExpression is disallowed in arrow parameters in a generator. | |
| 365 // - AwaitExpression is disallowed in arrow parameters in an async function. | |
| 366 // - AwaitExpression is disallowed in async arrow parameters. | |
| 367 // | |
| 368 V8_INLINE void AccumulateFormalParameterContainmentErrors( | |
| 369 ExpressionClassifier* inner) { | |
| 370 Accumulate(inner, FormalParameterInitializerProduction | | |
| 371 AsyncArrowFormalParametersProduction); | |
| 372 } | |
| 373 | |
| 374 V8_INLINE int GetNonPatternBegin() const { return non_pattern_begin_; } | 360 V8_INLINE int GetNonPatternBegin() const { return non_pattern_begin_; } |
| 375 | 361 |
| 376 V8_INLINE void Discard() { | 362 V8_INLINE void Discard() { |
| 377 if (reported_errors_end_ == reported_errors_->length()) { | 363 if (reported_errors_end_ == reported_errors_->length()) { |
| 378 reported_errors_->Rewind(reported_errors_begin_); | 364 reported_errors_->Rewind(reported_errors_begin_); |
| 379 reported_errors_end_ = reported_errors_begin_; | 365 reported_errors_end_ = reported_errors_begin_; |
| 380 } | 366 } |
| 381 DCHECK_EQ(reported_errors_begin_, reported_errors_end_); | 367 DCHECK_EQ(reported_errors_begin_, reported_errors_end_); |
| 382 DCHECK_LE(non_pattern_begin_, non_patterns_to_rewrite_->length()); | 368 DCHECK_LE(non_pattern_begin_, non_patterns_to_rewrite_->length()); |
| 383 non_patterns_to_rewrite_->Rewind(non_pattern_begin_); | 369 non_patterns_to_rewrite_->Rewind(non_pattern_begin_); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 444 }; | 430 }; |
| 445 | 431 |
| 446 | 432 |
| 447 #undef ERROR_CODES | 433 #undef ERROR_CODES |
| 448 | 434 |
| 449 | 435 |
| 450 } // namespace internal | 436 } // namespace internal |
| 451 } // namespace v8 | 437 } // namespace v8 |
| 452 | 438 |
| 453 #endif // V8_PARSING_EXPRESSION_CLASSIFIER_H | 439 #endif // V8_PARSING_EXPRESSION_CLASSIFIER_H |
| OLD | NEW |