| 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_EXPRESSION_CLASSIFIER_H | 5 #ifndef V8_EXPRESSION_CLASSIFIER_H |
| 6 #define V8_EXPRESSION_CLASSIFIER_H | 6 #define V8_EXPRESSION_CLASSIFIER_H |
| 7 | 7 |
| 8 #include "src/v8.h" | 8 #include "src/v8.h" |
| 9 | 9 |
| 10 #include "src/messages.h" | 10 #include "src/messages.h" |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 // As an exception to the above, the result continues to be a valid arrow | 218 // As an exception to the above, the result continues to be a valid arrow |
| 219 // formal parameters if the inner expression is a valid binding pattern. | 219 // formal parameters if the inner expression is a valid binding pattern. |
| 220 if (productions & ArrowFormalParametersProduction && | 220 if (productions & ArrowFormalParametersProduction && |
| 221 is_valid_arrow_formal_parameters() && | 221 is_valid_arrow_formal_parameters() && |
| 222 !inner.is_valid_binding_pattern()) { | 222 !inner.is_valid_binding_pattern()) { |
| 223 invalid_productions_ |= ArrowFormalParametersProduction; | 223 invalid_productions_ |= ArrowFormalParametersProduction; |
| 224 arrow_formal_parameters_error_ = inner.binding_pattern_error_; | 224 arrow_formal_parameters_error_ = inner.binding_pattern_error_; |
| 225 } | 225 } |
| 226 } | 226 } |
| 227 | 227 |
| 228 void AccumulateReclassifyingAsPattern(const ExpressionClassifier& inner) { | |
| 229 Accumulate(inner, AllProductions & ~PatternProductions); | |
| 230 if (!inner.is_valid_expression()) { | |
| 231 if (is_valid_binding_pattern()) { | |
| 232 binding_pattern_error_ = inner.expression_error(); | |
| 233 } | |
| 234 if (is_valid_assignment_pattern()) { | |
| 235 assignment_pattern_error_ = inner.expression_error(); | |
| 236 } | |
| 237 } | |
| 238 } | |
| 239 | |
| 240 private: | 228 private: |
| 241 unsigned invalid_productions_; | 229 unsigned invalid_productions_; |
| 242 Error expression_error_; | 230 Error expression_error_; |
| 243 Error binding_pattern_error_; | 231 Error binding_pattern_error_; |
| 244 Error assignment_pattern_error_; | 232 Error assignment_pattern_error_; |
| 245 Error arrow_formal_parameters_error_; | 233 Error arrow_formal_parameters_error_; |
| 246 Error duplicate_formal_parameter_error_; | 234 Error duplicate_formal_parameter_error_; |
| 247 Error strict_mode_formal_parameter_error_; | 235 Error strict_mode_formal_parameter_error_; |
| 248 Error strong_mode_formal_parameter_error_; | 236 Error strong_mode_formal_parameter_error_; |
| 249 DuplicateFinder* duplicate_finder_; | 237 DuplicateFinder* duplicate_finder_; |
| 250 }; | 238 }; |
| 251 } | 239 } |
| 252 } // v8::internal | 240 } // v8::internal |
| 253 | 241 |
| 254 #endif // V8_EXPRESSION_CLASSIFIER_H | 242 #endif // V8_EXPRESSION_CLASSIFIER_H |
| OLD | NEW |