Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: src/parser.cc

Issue 1292393002: [parser] make kInvalidLhsInFor a SyntaxError (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Correct tests Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/preparser.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 3675 matching lines...) Expand 10 before | Expand all | Expand 10 after
3686 bool accept_OF = expression->IsVariableProxy(); 3686 bool accept_OF = expression->IsVariableProxy();
3687 is_let_identifier_expression = 3687 is_let_identifier_expression =
3688 expression->IsVariableProxy() && 3688 expression->IsVariableProxy() &&
3689 expression->AsVariableProxy()->raw_name() == 3689 expression->AsVariableProxy()->raw_name() ==
3690 ast_value_factory()->let_string(); 3690 ast_value_factory()->let_string();
3691 3691
3692 if (CheckInOrOf(accept_OF, &mode, ok)) { 3692 if (CheckInOrOf(accept_OF, &mode, ok)) {
3693 if (!*ok) return nullptr; 3693 if (!*ok) return nullptr;
3694 expression = this->CheckAndRewriteReferenceExpression( 3694 expression = this->CheckAndRewriteReferenceExpression(
3695 expression, lhs_beg_pos, lhs_end_pos, 3695 expression, lhs_beg_pos, lhs_end_pos,
3696 MessageTemplate::kInvalidLhsInFor, CHECK_OK); 3696 MessageTemplate::kInvalidLhsInFor, kSyntaxError, CHECK_OK);
3697 3697
3698 ForEachStatement* loop = 3698 ForEachStatement* loop =
3699 factory()->NewForEachStatement(mode, labels, stmt_pos); 3699 factory()->NewForEachStatement(mode, labels, stmt_pos);
3700 Target target(&this->target_stack_, loop); 3700 Target target(&this->target_stack_, loop);
3701 3701
3702 Expression* enumerable = ParseExpression(true, CHECK_OK); 3702 Expression* enumerable = ParseExpression(true, CHECK_OK);
3703 Expect(Token::RPAREN, CHECK_OK); 3703 Expect(Token::RPAREN, CHECK_OK);
3704 3704
3705 Statement* body = ParseSubStatement(NULL, CHECK_OK); 3705 Statement* body = ParseSubStatement(NULL, CHECK_OK);
3706 InitializeForEachStatement(loop, expression, enumerable, body); 3706 InitializeForEachStatement(loop, expression, enumerable, body);
(...skipping 2308 matching lines...) Expand 10 before | Expand all | Expand 10 after
6015 Expression* Parser::SpreadCallNew(Expression* function, 6015 Expression* Parser::SpreadCallNew(Expression* function,
6016 ZoneList<v8::internal::Expression*>* args, 6016 ZoneList<v8::internal::Expression*>* args,
6017 int pos) { 6017 int pos) {
6018 args->InsertAt(0, function, zone()); 6018 args->InsertAt(0, function, zone());
6019 6019
6020 return factory()->NewCallRuntime( 6020 return factory()->NewCallRuntime(
6021 ast_value_factory()->reflect_construct_string(), NULL, args, pos); 6021 ast_value_factory()->reflect_construct_string(), NULL, args, pos);
6022 } 6022 }
6023 } // namespace internal 6023 } // namespace internal
6024 } // namespace v8 6024 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/preparser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698