OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 #include <cmath> | 5 #include <cmath> |
6 | 6 |
7 #include "src/allocation.h" | 7 #include "src/allocation.h" |
8 #include "src/base/logging.h" | 8 #include "src/base/logging.h" |
9 #include "src/conversions-inl.h" | 9 #include "src/conversions-inl.h" |
10 #include "src/conversions.h" | 10 #include "src/conversions.h" |
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
584 ValidateLetPattern(&pattern_classifier, CHECK_OK); | 584 ValidateLetPattern(&pattern_classifier, CHECK_OK); |
585 } | 585 } |
586 | 586 |
587 if (!allow_harmony_destructuring_bind() && !pattern.IsIdentifier()) { | 587 if (!allow_harmony_destructuring_bind() && !pattern.IsIdentifier()) { |
588 ReportUnexpectedToken(next); | 588 ReportUnexpectedToken(next); |
589 *ok = false; | 589 *ok = false; |
590 return Statement::Default(); | 590 return Statement::Default(); |
591 } | 591 } |
592 } | 592 } |
593 | 593 |
594 is_pattern = pattern.IsObjectLiteral() || pattern.IsArrayLiteral(); | 594 is_pattern = (pattern.IsObjectLiteral() || pattern.IsArrayLiteral()) && |
| 595 !pattern.is_parenthesized(); |
595 | 596 |
596 bool is_for_iteration_variable = | 597 bool is_for_iteration_variable = |
597 var_context == kForStatement && | 598 var_context == kForStatement && |
598 (peek() == Token::IN || PeekContextualKeyword(CStrVector("of"))); | 599 (peek() == Token::IN || PeekContextualKeyword(CStrVector("of"))); |
599 | 600 |
600 Scanner::Location variable_loc = scanner()->location(); | 601 Scanner::Location variable_loc = scanner()->location(); |
601 nvars++; | 602 nvars++; |
602 if (Check(Token::ASSIGN)) { | 603 if (Check(Token::ASSIGN)) { |
603 ExpressionClassifier classifier; | 604 ExpressionClassifier classifier; |
604 ParseAssignmentExpression(var_context != kForStatement, &classifier, | 605 ParseAssignmentExpression(var_context != kForStatement, &classifier, |
(...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1282 Expect(Token::RBRACE, CHECK_OK); | 1283 Expect(Token::RBRACE, CHECK_OK); |
1283 return PreParserExpression::Default(); | 1284 return PreParserExpression::Default(); |
1284 } | 1285 } |
1285 } | 1286 } |
1286 | 1287 |
1287 #undef CHECK_OK | 1288 #undef CHECK_OK |
1288 | 1289 |
1289 | 1290 |
1290 } // namespace internal | 1291 } // namespace internal |
1291 } // namespace v8 | 1292 } // namespace v8 |
OLD | NEW |