| 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/scopes.h" | 8 #include "src/ast/scopes.h" |
| 9 #include "src/bailout-reason.h" | 9 #include "src/bailout-reason.h" |
| 10 #include "src/hashmap.h" | 10 #include "src/hashmap.h" |
| (...skipping 3259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3270 | 3270 |
| 3271 | 3271 |
| 3272 template <typename Traits> | 3272 template <typename Traits> |
| 3273 void ParserBase<Traits>::CheckDestructuringElement( | 3273 void ParserBase<Traits>::CheckDestructuringElement( |
| 3274 ExpressionT expression, ExpressionClassifier* classifier, int begin, | 3274 ExpressionT expression, ExpressionClassifier* classifier, int begin, |
| 3275 int end) { | 3275 int end) { |
| 3276 static const MessageTemplate::Template message = | 3276 static const MessageTemplate::Template message = |
| 3277 MessageTemplate::kInvalidDestructuringTarget; | 3277 MessageTemplate::kInvalidDestructuringTarget; |
| 3278 const Scanner::Location location(begin, end); | 3278 const Scanner::Location location(begin, end); |
| 3279 if (expression->IsArrayLiteral() || expression->IsObjectLiteral() || | 3279 if (expression->IsArrayLiteral() || expression->IsObjectLiteral() || |
| 3280 expression->IsAssignment()) | 3280 expression->IsAssignment()) { |
| 3281 if (expression->is_parenthesized()) { |
| 3282 classifier->RecordPatternError(location, message); |
| 3283 } |
| 3281 return; | 3284 return; |
| 3285 } |
| 3286 |
| 3282 if (expression->IsProperty()) { | 3287 if (expression->IsProperty()) { |
| 3283 classifier->RecordBindingPatternError(location, message); | 3288 classifier->RecordBindingPatternError(location, message); |
| 3284 } else if (!this->IsAssignableIdentifier(expression)) { | 3289 } else if (!this->IsAssignableIdentifier(expression)) { |
| 3285 classifier->RecordPatternError(location, message); | 3290 classifier->RecordPatternError(location, message); |
| 3286 } | 3291 } |
| 3287 } | 3292 } |
| 3288 | 3293 |
| 3289 | 3294 |
| 3290 #undef CHECK_OK | 3295 #undef CHECK_OK |
| 3291 #undef CHECK_OK_CUSTOM | 3296 #undef CHECK_OK_CUSTOM |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3341 return; | 3346 return; |
| 3342 } | 3347 } |
| 3343 has_seen_constructor_ = true; | 3348 has_seen_constructor_ = true; |
| 3344 return; | 3349 return; |
| 3345 } | 3350 } |
| 3346 } | 3351 } |
| 3347 } // namespace internal | 3352 } // namespace internal |
| 3348 } // namespace v8 | 3353 } // namespace v8 |
| 3349 | 3354 |
| 3350 #endif // V8_PARSING_PARSER_BASE_H | 3355 #endif // V8_PARSING_PARSER_BASE_H |
| OLD | NEW |