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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 AllProductions = | 70 AllProductions = |
71 (ExpressionProductions | PatternProductions | | 71 (ExpressionProductions | PatternProductions | |
72 FormalParametersProductions | ArrowFormalParametersProduction | | 72 FormalParametersProductions | ArrowFormalParametersProduction | |
73 ObjectLiteralProduction | AsyncArrowFormalParametersProduction) | 73 ObjectLiteralProduction | AsyncArrowFormalParametersProduction) |
74 }; | 74 }; |
75 | 75 |
76 enum FunctionProperties : unsigned { | 76 enum FunctionProperties : unsigned { |
77 NonSimpleParameter = 1 << 0 | 77 NonSimpleParameter = 1 << 0 |
78 }; | 78 }; |
79 | 79 |
80 explicit ExpressionClassifier(const Traits* t) | 80 explicit ExpressionClassifier(const typename Traits::Type::Base* base, |
81 : zone_(t->zone()), | 81 DuplicateFinder* duplicate_finder = nullptr) |
82 non_patterns_to_rewrite_(t->GetNonPatternList()), | 82 : zone_(base->impl()->zone()), |
83 reported_errors_(t->GetReportedErrorList()), | 83 non_patterns_to_rewrite_(base->impl()->GetNonPatternList()), |
84 duplicate_finder_(nullptr), | 84 reported_errors_(base->impl()->GetReportedErrorList()), |
85 invalid_productions_(0), | |
86 function_properties_(0) { | |
87 reported_errors_begin_ = reported_errors_end_ = reported_errors_->length(); | |
88 non_pattern_begin_ = non_patterns_to_rewrite_->length(); | |
89 } | |
90 | |
91 ExpressionClassifier(const Traits* t, DuplicateFinder* duplicate_finder) | |
92 : zone_(t->zone()), | |
93 non_patterns_to_rewrite_(t->GetNonPatternList()), | |
94 reported_errors_(t->GetReportedErrorList()), | |
95 duplicate_finder_(duplicate_finder), | 85 duplicate_finder_(duplicate_finder), |
96 invalid_productions_(0), | 86 invalid_productions_(0), |
97 function_properties_(0) { | 87 function_properties_(0) { |
98 reported_errors_begin_ = reported_errors_end_ = reported_errors_->length(); | 88 reported_errors_begin_ = reported_errors_end_ = reported_errors_->length(); |
99 non_pattern_begin_ = non_patterns_to_rewrite_->length(); | 89 non_pattern_begin_ = non_patterns_to_rewrite_->length(); |
100 } | 90 } |
101 | 91 |
102 ~ExpressionClassifier() { Discard(); } | 92 ~ExpressionClassifier() { Discard(); } |
103 | 93 |
104 V8_INLINE bool is_valid(unsigned productions) const { | 94 V8_INLINE bool is_valid(unsigned productions) const { |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
459 }; | 449 }; |
460 | 450 |
461 | 451 |
462 #undef ERROR_CODES | 452 #undef ERROR_CODES |
463 | 453 |
464 | 454 |
465 } // namespace internal | 455 } // namespace internal |
466 } // namespace v8 | 456 } // namespace v8 |
467 | 457 |
468 #endif // V8_PARSING_EXPRESSION_CLASSIFIER_H | 458 #endif // V8_PARSING_EXPRESSION_CLASSIFIER_H |
OLD | NEW |