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

Side by Side Diff: src/preparser.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 | « src/preparser.h ('k') | test/message/for-loop-invalid-lhs.out » ('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 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 904 matching lines...) Expand 10 before | Expand all | Expand 10 after
915 } else { 915 } else {
916 int lhs_beg_pos = peek_position(); 916 int lhs_beg_pos = peek_position();
917 Expression lhs = ParseExpression(false, CHECK_OK); 917 Expression lhs = ParseExpression(false, CHECK_OK);
918 int lhs_end_pos = scanner()->location().end_pos; 918 int lhs_end_pos = scanner()->location().end_pos;
919 is_let_identifier_expression = 919 is_let_identifier_expression =
920 lhs.IsIdentifier() && lhs.AsIdentifier().IsLet(); 920 lhs.IsIdentifier() && lhs.AsIdentifier().IsLet();
921 if (CheckInOrOf(lhs.IsIdentifier(), &mode, ok)) { 921 if (CheckInOrOf(lhs.IsIdentifier(), &mode, ok)) {
922 if (!*ok) return Statement::Default(); 922 if (!*ok) return Statement::Default();
923 lhs = CheckAndRewriteReferenceExpression( 923 lhs = CheckAndRewriteReferenceExpression(
924 lhs, lhs_beg_pos, lhs_end_pos, MessageTemplate::kInvalidLhsInFor, 924 lhs, lhs_beg_pos, lhs_end_pos, MessageTemplate::kInvalidLhsInFor,
925 CHECK_OK); 925 kSyntaxError, CHECK_OK);
926 ParseExpression(true, CHECK_OK); 926 ParseExpression(true, CHECK_OK);
927 Expect(Token::RPAREN, CHECK_OK); 927 Expect(Token::RPAREN, CHECK_OK);
928 ParseSubStatement(CHECK_OK); 928 ParseSubStatement(CHECK_OK);
929 return Statement::Default(); 929 return Statement::Default();
930 } 930 }
931 } 931 }
932 } 932 }
933 933
934 // Parsed initializer at this point. 934 // Parsed initializer at this point.
935 // Detect attempts at 'let' declarations in sloppy mode. 935 // Detect attempts at 'let' declarations in sloppy mode.
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
1204 1204
1205 DCHECK(!spread_pos.IsValid()); 1205 DCHECK(!spread_pos.IsValid());
1206 1206
1207 return Expression::Default(); 1207 return Expression::Default();
1208 } 1208 }
1209 1209
1210 #undef CHECK_OK 1210 #undef CHECK_OK
1211 1211
1212 1212
1213 } } // v8::internal 1213 } } // v8::internal
OLDNEW
« no previous file with comments | « src/preparser.h ('k') | test/message/for-loop-invalid-lhs.out » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698