| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 574 if (!is_classic_mode()) { | 574 if (!is_classic_mode()) { |
| 575 i::Scanner::Location location = scanner_->location(); | 575 i::Scanner::Location location = scanner_->location(); |
| 576 ReportMessageAt(location, "strict_mode_with", NULL); | 576 ReportMessageAt(location, "strict_mode_with", NULL); |
| 577 *ok = false; | 577 *ok = false; |
| 578 return Statement::Default(); | 578 return Statement::Default(); |
| 579 } | 579 } |
| 580 Expect(i::Token::LPAREN, CHECK_OK); | 580 Expect(i::Token::LPAREN, CHECK_OK); |
| 581 ParseExpression(true, CHECK_OK); | 581 ParseExpression(true, CHECK_OK); |
| 582 Expect(i::Token::RPAREN, CHECK_OK); | 582 Expect(i::Token::RPAREN, CHECK_OK); |
| 583 | 583 |
| 584 scope_->EnterWith(); | 584 Scope::InsideWith iw(scope_); |
| 585 ParseStatement(CHECK_OK); | 585 ParseStatement(CHECK_OK); |
| 586 scope_->LeaveWith(); | |
| 587 return Statement::Default(); | 586 return Statement::Default(); |
| 588 } | 587 } |
| 589 | 588 |
| 590 | 589 |
| 591 PreParser::Statement PreParser::ParseSwitchStatement(bool* ok) { | 590 PreParser::Statement PreParser::ParseSwitchStatement(bool* ok) { |
| 592 // SwitchStatement :: | 591 // SwitchStatement :: |
| 593 // 'switch' '(' Expression ')' '{' CaseClause* '}' | 592 // 'switch' '(' Expression ')' '{' CaseClause* '}' |
| 594 | 593 |
| 595 Expect(i::Token::SWITCH, CHECK_OK); | 594 Expect(i::Token::SWITCH, CHECK_OK); |
| 596 Expect(i::Token::LPAREN, CHECK_OK); | 595 Expect(i::Token::LPAREN, CHECK_OK); |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 742 Expect(i::Token::LPAREN, CHECK_OK); | 741 Expect(i::Token::LPAREN, CHECK_OK); |
| 743 Identifier id = ParseIdentifier(CHECK_OK); | 742 Identifier id = ParseIdentifier(CHECK_OK); |
| 744 if (!is_classic_mode() && !id.IsValidStrictVariable()) { | 743 if (!is_classic_mode() && !id.IsValidStrictVariable()) { |
| 745 StrictModeIdentifierViolation(scanner_->location(), | 744 StrictModeIdentifierViolation(scanner_->location(), |
| 746 "strict_catch_variable", | 745 "strict_catch_variable", |
| 747 id, | 746 id, |
| 748 ok); | 747 ok); |
| 749 return Statement::Default(); | 748 return Statement::Default(); |
| 750 } | 749 } |
| 751 Expect(i::Token::RPAREN, CHECK_OK); | 750 Expect(i::Token::RPAREN, CHECK_OK); |
| 752 scope_->EnterWith(); | 751 { Scope::InsideWith iw(scope_); |
| 753 ParseBlock(ok); | 752 ParseBlock(CHECK_OK); |
| 754 scope_->LeaveWith(); | 753 } |
| 755 if (!*ok) Statement::Default(); | |
| 756 catch_or_finally_seen = true; | 754 catch_or_finally_seen = true; |
| 757 } | 755 } |
| 758 if (peek() == i::Token::FINALLY) { | 756 if (peek() == i::Token::FINALLY) { |
| 759 Consume(i::Token::FINALLY); | 757 Consume(i::Token::FINALLY); |
| 760 ParseBlock(CHECK_OK); | 758 ParseBlock(CHECK_OK); |
| 761 catch_or_finally_seen = true; | 759 catch_or_finally_seen = true; |
| 762 } | 760 } |
| 763 if (!catch_or_finally_seen) { | 761 if (!catch_or_finally_seen) { |
| 764 *ok = false; | 762 *ok = false; |
| 765 } | 763 } |
| (...skipping 1013 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1779 backing_store_.Add(static_cast<byte>((ascii_length >> 14) | 0x80u)); | 1777 backing_store_.Add(static_cast<byte>((ascii_length >> 14) | 0x80u)); |
| 1780 } | 1778 } |
| 1781 backing_store_.Add(static_cast<byte>((ascii_length >> 7) | 0x80u)); | 1779 backing_store_.Add(static_cast<byte>((ascii_length >> 7) | 0x80u)); |
| 1782 } | 1780 } |
| 1783 backing_store_.Add(static_cast<byte>(ascii_length & 0x7f)); | 1781 backing_store_.Add(static_cast<byte>(ascii_length & 0x7f)); |
| 1784 | 1782 |
| 1785 backing_store_.AddBlock(bytes); | 1783 backing_store_.AddBlock(bytes); |
| 1786 return backing_store_.EndSequence().start(); | 1784 return backing_store_.EndSequence().start(); |
| 1787 } | 1785 } |
| 1788 } } // v8::preparser | 1786 } } // v8::preparser |
| OLD | NEW |