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/v8.h" | 5 #include "src/v8.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/bailout-reason.h" | 9 #include "src/bailout-reason.h" |
10 #include "src/base/platform/platform.h" | 10 #include "src/base/platform/platform.h" |
(...skipping 2585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2596 break; | 2596 break; |
2597 | 2597 |
2598 // TODO(arv): Handle `let [` | 2598 // TODO(arv): Handle `let [` |
2599 // https://code.google.com/p/v8/issues/detail?id=3847 | 2599 // https://code.google.com/p/v8/issues/detail?id=3847 |
2600 | 2600 |
2601 default: | 2601 default: |
2602 break; | 2602 break; |
2603 } | 2603 } |
2604 | 2604 |
2605 bool starts_with_idenfifier = peek_any_identifier(); | 2605 bool starts_with_idenfifier = peek_any_identifier(); |
| 2606 |
2606 Expression* expr = ParseExpression(true, CHECK_OK); | 2607 Expression* expr = ParseExpression(true, CHECK_OK); |
2607 if (peek() == Token::COLON && starts_with_idenfifier && expr != NULL && | 2608 if (peek() == Token::COLON && starts_with_idenfifier && expr != NULL && |
2608 expr->AsVariableProxy() != NULL && | 2609 expr->AsVariableProxy() != NULL && |
2609 !expr->AsVariableProxy()->is_this()) { | 2610 !expr->AsVariableProxy()->is_this()) { |
2610 // Expression is a single identifier, and not, e.g., a parenthesized | 2611 // Expression is a single identifier, and not, e.g., a parenthesized |
2611 // identifier. | 2612 // identifier. |
2612 VariableProxy* var = expr->AsVariableProxy(); | 2613 VariableProxy* var = expr->AsVariableProxy(); |
2613 const AstRawString* label = var->raw_name(); | 2614 const AstRawString* label = var->raw_name(); |
2614 // TODO(1240780): We don't check for redeclaration of labels | 2615 // TODO(1240780): We don't check for redeclaration of labels |
2615 // during preparsing since keeping track of the set of active | 2616 // during preparsing since keeping track of the set of active |
(...skipping 812 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3428 | 3429 |
3429 inner_scope->set_end_position(scanner()->location().end_pos); | 3430 inner_scope->set_end_position(scanner()->location().end_pos); |
3430 inner_block->set_scope(inner_scope); | 3431 inner_block->set_scope(inner_scope); |
3431 scope_ = for_scope; | 3432 scope_ = for_scope; |
3432 | 3433 |
3433 outer_loop->Initialize(NULL, NULL, NULL, inner_block); | 3434 outer_loop->Initialize(NULL, NULL, NULL, inner_block); |
3434 return outer_block; | 3435 return outer_block; |
3435 } | 3436 } |
3436 | 3437 |
3437 | 3438 |
| 3439 Expression* Parser::DesugarDestructuringAssignment(Expression* expr, bool* ok) { |
| 3440 // TODO(caitp): implement the desugaring |
| 3441 DCHECK(expr->IsAssignment()); |
| 3442 Assignment* assign = expr->AsAssignment(); |
| 3443 while (assign->value()->IsAssignment()) { |
| 3444 assign = assign->value()->AsAssignment(); |
| 3445 } |
| 3446 return assign->value(); |
| 3447 } |
| 3448 |
| 3449 |
3438 Statement* Parser::ParseForStatement(ZoneList<const AstRawString*>* labels, | 3450 Statement* Parser::ParseForStatement(ZoneList<const AstRawString*>* labels, |
3439 bool* ok) { | 3451 bool* ok) { |
3440 // ForStatement :: | 3452 // ForStatement :: |
3441 // 'for' '(' Expression? ';' Expression? ';' Expression? ')' Statement | 3453 // 'for' '(' Expression? ';' Expression? ';' Expression? ')' Statement |
3442 | 3454 |
3443 int stmt_pos = peek_position(); | 3455 int stmt_pos = peek_position(); |
3444 bool is_const = false; | 3456 bool is_const = false; |
3445 Statement* init = NULL; | 3457 Statement* init = NULL; |
3446 ZoneList<const AstRawString*> lexical_bindings(1, zone()); | 3458 ZoneList<const AstRawString*> lexical_bindings(1, zone()); |
3447 | 3459 |
(...skipping 2371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5819 Expression* Parser::SpreadCallNew(Expression* function, | 5831 Expression* Parser::SpreadCallNew(Expression* function, |
5820 ZoneList<v8::internal::Expression*>* args, | 5832 ZoneList<v8::internal::Expression*>* args, |
5821 int pos) { | 5833 int pos) { |
5822 args->InsertAt(0, function, zone()); | 5834 args->InsertAt(0, function, zone()); |
5823 | 5835 |
5824 return factory()->NewCallRuntime( | 5836 return factory()->NewCallRuntime( |
5825 ast_value_factory()->reflect_construct_string(), NULL, args, pos); | 5837 ast_value_factory()->reflect_construct_string(), NULL, args, pos); |
5826 } | 5838 } |
5827 } // namespace internal | 5839 } // namespace internal |
5828 } // namespace v8 | 5840 } // namespace v8 |
OLD | NEW |