| 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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 case Token::FUNCTION: | 191 case Token::FUNCTION: |
| 192 return ParseFunctionDeclaration(ok); | 192 return ParseFunctionDeclaration(ok); |
| 193 case Token::CLASS: | 193 case Token::CLASS: |
| 194 return ParseClassDeclaration(ok); | 194 return ParseClassDeclaration(ok); |
| 195 case Token::CONST: | 195 case Token::CONST: |
| 196 if (allow_const()) { | 196 if (allow_const()) { |
| 197 return ParseVariableStatement(kStatementListItem, ok); | 197 return ParseVariableStatement(kStatementListItem, ok); |
| 198 } | 198 } |
| 199 break; | 199 break; |
| 200 case Token::LET: | 200 case Token::LET: |
| 201 if (allow_let()) { | 201 if (IsNextLetKeyword()) { |
| 202 return ParseVariableStatement(kStatementListItem, ok); | 202 return ParseVariableStatement(kStatementListItem, ok); |
| 203 } | 203 } |
| 204 break; | 204 break; |
| 205 default: | 205 default: |
| 206 break; | 206 break; |
| 207 } | 207 } |
| 208 return ParseStatement(ok); | 208 return ParseStatement(ok); |
| 209 } | 209 } |
| 210 | 210 |
| 211 | 211 |
| (...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 867 PreParser::Statement PreParser::ParseForStatement(bool* ok) { | 867 PreParser::Statement PreParser::ParseForStatement(bool* ok) { |
| 868 // ForStatement :: | 868 // ForStatement :: |
| 869 // 'for' '(' Expression? ';' Expression? ';' Expression? ')' Statement | 869 // 'for' '(' Expression? ';' Expression? ';' Expression? ')' Statement |
| 870 | 870 |
| 871 Expect(Token::FOR, CHECK_OK); | 871 Expect(Token::FOR, CHECK_OK); |
| 872 Expect(Token::LPAREN, CHECK_OK); | 872 Expect(Token::LPAREN, CHECK_OK); |
| 873 bool is_let_identifier_expression = false; | 873 bool is_let_identifier_expression = false; |
| 874 if (peek() != Token::SEMICOLON) { | 874 if (peek() != Token::SEMICOLON) { |
| 875 ForEachStatement::VisitMode mode; | 875 ForEachStatement::VisitMode mode; |
| 876 if (peek() == Token::VAR || (peek() == Token::CONST && allow_const()) || | 876 if (peek() == Token::VAR || (peek() == Token::CONST && allow_const()) || |
| 877 (peek() == Token::LET && allow_let())) { | 877 (peek() == Token::LET && IsNextLetKeyword())) { |
| 878 int decl_count; | 878 int decl_count; |
| 879 Scanner::Location first_initializer_loc = Scanner::Location::invalid(); | 879 Scanner::Location first_initializer_loc = Scanner::Location::invalid(); |
| 880 Scanner::Location bindings_loc = Scanner::Location::invalid(); | 880 Scanner::Location bindings_loc = Scanner::Location::invalid(); |
| 881 ParseVariableDeclarations(kForStatement, &decl_count, | 881 ParseVariableDeclarations(kForStatement, &decl_count, |
| 882 &first_initializer_loc, &bindings_loc, | 882 &first_initializer_loc, &bindings_loc, |
| 883 CHECK_OK); | 883 CHECK_OK); |
| 884 bool accept_IN = decl_count >= 1; | 884 bool accept_IN = decl_count >= 1; |
| 885 bool accept_OF = true; | 885 bool accept_OF = true; |
| 886 if (accept_IN && CheckInOrOf(accept_OF, &mode, ok)) { | 886 if (accept_IN && CheckInOrOf(accept_OF, &mode, ok)) { |
| 887 if (!*ok) return Statement::Default(); | 887 if (!*ok) return Statement::Default(); |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |
| OLD | NEW |