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 #include "src/parser.h" | 5 #include "src/parser.h" |
6 | 6 |
7 #include "src/api.h" | 7 #include "src/api.h" |
8 #include "src/ast.h" | 8 #include "src/ast.h" |
9 #include "src/ast-literal-reindexer.h" | 9 #include "src/ast-literal-reindexer.h" |
10 #include "src/bailout-reason.h" | 10 #include "src/bailout-reason.h" |
(...skipping 2517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2528 if (!first_declaration) Consume(Token::COMMA); | 2528 if (!first_declaration) Consume(Token::COMMA); |
2529 | 2529 |
2530 Expression* pattern; | 2530 Expression* pattern; |
2531 { | 2531 { |
2532 ExpressionClassifier pattern_classifier; | 2532 ExpressionClassifier pattern_classifier; |
2533 Token::Value next = peek(); | 2533 Token::Value next = peek(); |
2534 pattern = ParsePrimaryExpression(&pattern_classifier, ok); | 2534 pattern = ParsePrimaryExpression(&pattern_classifier, ok); |
2535 if (!*ok) return; | 2535 if (!*ok) return; |
2536 ValidateBindingPattern(&pattern_classifier, ok); | 2536 ValidateBindingPattern(&pattern_classifier, ok); |
2537 if (!*ok) return; | 2537 if (!*ok) return; |
| 2538 if (IsLexicalVariableMode(parsing_result->descriptor.mode)) { |
| 2539 ValidateLetPattern(&pattern_classifier, ok); |
| 2540 if (!*ok) return; |
| 2541 } |
2538 if (!allow_harmony_destructuring() && !pattern->IsVariableProxy()) { | 2542 if (!allow_harmony_destructuring() && !pattern->IsVariableProxy()) { |
2539 ReportUnexpectedToken(next); | 2543 ReportUnexpectedToken(next); |
2540 *ok = false; | 2544 *ok = false; |
2541 return; | 2545 return; |
2542 } | 2546 } |
2543 } | 2547 } |
2544 | 2548 |
2545 Scanner::Location variable_loc = scanner()->location(); | 2549 Scanner::Location variable_loc = scanner()->location(); |
2546 const AstRawString* single_name = | 2550 const AstRawString* single_name = |
2547 pattern->IsVariableProxy() ? pattern->AsVariableProxy()->raw_name() | 2551 pattern->IsVariableProxy() ? pattern->AsVariableProxy()->raw_name() |
(...skipping 3771 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6319 | 6323 |
6320 Expression* Parser::SpreadCallNew(Expression* function, | 6324 Expression* Parser::SpreadCallNew(Expression* function, |
6321 ZoneList<v8::internal::Expression*>* args, | 6325 ZoneList<v8::internal::Expression*>* args, |
6322 int pos) { | 6326 int pos) { |
6323 args->InsertAt(0, function, zone()); | 6327 args->InsertAt(0, function, zone()); |
6324 | 6328 |
6325 return factory()->NewCallRuntime(Context::REFLECT_CONSTRUCT_INDEX, args, pos); | 6329 return factory()->NewCallRuntime(Context::REFLECT_CONSTRUCT_INDEX, args, pos); |
6326 } | 6330 } |
6327 } // namespace internal | 6331 } // namespace internal |
6328 } // namespace v8 | 6332 } // namespace v8 |
OLD | NEW |