| 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 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 470 Identifier name = | 470 Identifier name = |
| 471 ParseIdentifierOrStrictReservedWord(&is_strict_reserved, CHECK_OK); | 471 ParseIdentifierOrStrictReservedWord(&is_strict_reserved, CHECK_OK); |
| 472 ParseClassLiteral(name, scanner()->location(), is_strict_reserved, pos, | 472 ParseClassLiteral(name, scanner()->location(), is_strict_reserved, pos, |
| 473 CHECK_OK); | 473 CHECK_OK); |
| 474 return Statement::Default(); | 474 return Statement::Default(); |
| 475 } | 475 } |
| 476 | 476 |
| 477 | 477 |
| 478 PreParser::Statement PreParser::ParseBlock(bool* ok) { | 478 PreParser::Statement PreParser::ParseBlock(bool* ok) { |
| 479 // Block :: | 479 // Block :: |
| 480 // '{' Statement* '}' | 480 // '{' StatementList '}' |
| 481 | 481 |
| 482 // Note that a Block does not introduce a new execution scope! | |
| 483 // (ECMA-262, 3rd, 12.2) | |
| 484 // | |
| 485 Expect(Token::LBRACE, CHECK_OK); | 482 Expect(Token::LBRACE, CHECK_OK); |
| 486 Statement final = Statement::Default(); | 483 Statement final = Statement::Default(); |
| 487 while (peek() != Token::RBRACE) { | 484 while (peek() != Token::RBRACE) { |
| 488 if (is_strict(language_mode()) || allow_harmony_sloppy()) { | 485 final = ParseStatementListItem(CHECK_OK); |
| 489 final = ParseStatementListItem(CHECK_OK); | |
| 490 } else { | |
| 491 final = ParseStatement(CHECK_OK); | |
| 492 } | |
| 493 } | 486 } |
| 494 Expect(Token::RBRACE, ok); | 487 Expect(Token::RBRACE, ok); |
| 495 return final; | 488 return final; |
| 496 } | 489 } |
| 497 | 490 |
| 498 | 491 |
| 499 PreParser::Statement PreParser::ParseVariableStatement( | 492 PreParser::Statement PreParser::ParseVariableStatement( |
| 500 VariableDeclarationContext var_context, | 493 VariableDeclarationContext var_context, |
| 501 bool* ok) { | 494 bool* ok) { |
| 502 // VariableStatement :: | 495 // VariableStatement :: |
| (...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1267 Expect(Token::RBRACE, CHECK_OK); | 1260 Expect(Token::RBRACE, CHECK_OK); |
| 1268 return PreParserExpression::Default(); | 1261 return PreParserExpression::Default(); |
| 1269 } | 1262 } |
| 1270 } | 1263 } |
| 1271 | 1264 |
| 1272 #undef CHECK_OK | 1265 #undef CHECK_OK |
| 1273 | 1266 |
| 1274 | 1267 |
| 1275 } // namespace internal | 1268 } // namespace internal |
| 1276 } // namespace v8 | 1269 } // namespace v8 |
| OLD | NEW |