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 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 invalid_productions_ &= ~CoverInitializedNameProduction; | 338 invalid_productions_ &= ~CoverInitializedNameProduction; |
339 } | 339 } |
340 | 340 |
341 void ForgiveAssignmentPatternError() { | 341 void ForgiveAssignmentPatternError() { |
342 if (!(invalid_productions_ & AssignmentPatternProduction)) return; | 342 if (!(invalid_productions_ & AssignmentPatternProduction)) return; |
343 Error& e = reported_error(kAssignmentPatternProduction); | 343 Error& e = reported_error(kAssignmentPatternProduction); |
344 e.kind = kUnusedError; | 344 e.kind = kUnusedError; |
345 invalid_productions_ &= ~AssignmentPatternProduction; | 345 invalid_productions_ &= ~AssignmentPatternProduction; |
346 } | 346 } |
347 | 347 |
| 348 void ForgiveExpressionError() { |
| 349 if (!(invalid_productions_ & ExpressionProduction)) return; |
| 350 Error& e = reported_error(kExpressionProduction); |
| 351 e.kind = kUnusedError; |
| 352 invalid_productions_ &= ~ExpressionProduction; |
| 353 } |
| 354 |
348 void Accumulate(ExpressionClassifier* inner, | 355 void Accumulate(ExpressionClassifier* inner, |
349 unsigned productions = StandardProductions, | 356 unsigned productions = StandardProductions, |
350 bool merge_non_patterns = true) { | 357 bool merge_non_patterns = true) { |
351 DCHECK_EQ(inner->reported_errors_, reported_errors_); | 358 DCHECK_EQ(inner->reported_errors_, reported_errors_); |
352 DCHECK_EQ(inner->reported_errors_begin_, reported_errors_end_); | 359 DCHECK_EQ(inner->reported_errors_begin_, reported_errors_end_); |
353 DCHECK_EQ(inner->reported_errors_end_, reported_errors_->length()); | 360 DCHECK_EQ(inner->reported_errors_end_, reported_errors_->length()); |
354 if (merge_non_patterns) MergeNonPatterns(inner); | 361 if (merge_non_patterns) MergeNonPatterns(inner); |
355 // Propagate errors from inner, but don't overwrite already recorded | 362 // Propagate errors from inner, but don't overwrite already recorded |
356 // errors. | 363 // errors. |
357 unsigned non_arrow_inner_invalid_productions = | 364 unsigned non_arrow_inner_invalid_productions = |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
494 }; | 501 }; |
495 | 502 |
496 | 503 |
497 #undef ERROR_CODES | 504 #undef ERROR_CODES |
498 | 505 |
499 | 506 |
500 } // namespace internal | 507 } // namespace internal |
501 } // namespace v8 | 508 } // namespace v8 |
502 | 509 |
503 #endif // V8_PARSING_EXPRESSION_CLASSIFIER_H | 510 #endif // V8_PARSING_EXPRESSION_CLASSIFIER_H |
OLD | NEW |