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); |
3291 } else if (expression->is_parenthesized()) { | |
3292 classifier->RecordBindingPatternError(location, message); | |
caitp (gmail)
2016/01/12 23:15:16
technically, this bit isn't needed because of an U
adamk
2016/01/12 23:17:11
I'd rather leave this out of the change if we were
caitp (gmail)
2016/01/12 23:31:18
Alright, done, anything else?
| |
3286 } | 3293 } |
3287 } | 3294 } |
3288 | 3295 |
3289 | 3296 |
3290 #undef CHECK_OK | 3297 #undef CHECK_OK |
3291 #undef CHECK_OK_CUSTOM | 3298 #undef CHECK_OK_CUSTOM |
3292 | 3299 |
3293 | 3300 |
3294 template <typename Traits> | 3301 template <typename Traits> |
3295 void ParserBase<Traits>::ObjectLiteralChecker::CheckProperty( | 3302 void ParserBase<Traits>::ObjectLiteralChecker::CheckProperty( |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3341 return; | 3348 return; |
3342 } | 3349 } |
3343 has_seen_constructor_ = true; | 3350 has_seen_constructor_ = true; |
3344 return; | 3351 return; |
3345 } | 3352 } |
3346 } | 3353 } |
3347 } // namespace internal | 3354 } // namespace internal |
3348 } // namespace v8 | 3355 } // namespace v8 |
3349 | 3356 |
3350 #endif // V8_PARSING_PARSER_BASE_H | 3357 #endif // V8_PARSING_PARSER_BASE_H |
OLD | NEW |