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 895 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
906 } | 906 } |
907 *ok = false; | 907 *ok = false; |
908 return Statement::Default(); | 908 return Statement::Default(); |
909 } | 909 } |
910 ParseExpression(true, CHECK_OK); | 910 ParseExpression(true, CHECK_OK); |
911 Expect(Token::RPAREN, CHECK_OK); | 911 Expect(Token::RPAREN, CHECK_OK); |
912 ParseSubStatement(CHECK_OK); | 912 ParseSubStatement(CHECK_OK); |
913 return Statement::Default(); | 913 return Statement::Default(); |
914 } | 914 } |
915 } else { | 915 } else { |
| 916 int lhs_beg_pos = peek_position(); |
916 Expression lhs = ParseExpression(false, CHECK_OK); | 917 Expression lhs = ParseExpression(false, CHECK_OK); |
| 918 int lhs_end_pos = scanner()->location().end_pos; |
917 is_let_identifier_expression = | 919 is_let_identifier_expression = |
918 lhs.IsIdentifier() && lhs.AsIdentifier().IsLet(); | 920 lhs.IsIdentifier() && lhs.AsIdentifier().IsLet(); |
919 if (CheckInOrOf(lhs.IsIdentifier(), &mode, ok)) { | 921 if (CheckInOrOf(lhs.IsIdentifier(), &mode, ok)) { |
920 if (!*ok) return Statement::Default(); | 922 if (!*ok) return Statement::Default(); |
921 // TODO(adamk): Should call CheckAndRewriteReferenceExpression here | 923 lhs = CheckAndRewriteReferenceExpression( |
922 // to catch early errors if lhs is not a valid reference expression. | 924 lhs, lhs_beg_pos, lhs_end_pos, MessageTemplate::kInvalidLhsInFor, |
| 925 CHECK_OK); |
923 ParseExpression(true, CHECK_OK); | 926 ParseExpression(true, CHECK_OK); |
924 Expect(Token::RPAREN, CHECK_OK); | 927 Expect(Token::RPAREN, CHECK_OK); |
925 ParseSubStatement(CHECK_OK); | 928 ParseSubStatement(CHECK_OK); |
926 return Statement::Default(); | 929 return Statement::Default(); |
927 } | 930 } |
928 } | 931 } |
929 } | 932 } |
930 | 933 |
931 // Parsed initializer at this point. | 934 // Parsed initializer at this point. |
932 // 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 Loading... |
1201 | 1204 |
1202 DCHECK(!spread_pos.IsValid()); | 1205 DCHECK(!spread_pos.IsValid()); |
1203 | 1206 |
1204 return Expression::Default(); | 1207 return Expression::Default(); |
1205 } | 1208 } |
1206 | 1209 |
1207 #undef CHECK_OK | 1210 #undef CHECK_OK |
1208 | 1211 |
1209 | 1212 |
1210 } } // v8::internal | 1213 } } // v8::internal |
OLD | NEW |