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

Side by Side Diff: src/preparser.h

Issue 4639005: Preparsing now considers catch-blocks as inside a with. (Closed)
Patch Set: Upped version number of preparse data. Created 10 years, 1 month 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/parser.h ('k') | test/cctest/test-parsing.cc » ('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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 732 matching lines...) Expand 10 before | Expand all | Expand 10 after
743 743
744 // In preparsing, allow any number of catch/finally blocks, including zero 744 // In preparsing, allow any number of catch/finally blocks, including zero
745 // of both. 745 // of both.
746 746
747 Expect(i::Token::TRY, CHECK_OK); 747 Expect(i::Token::TRY, CHECK_OK);
748 748
749 ParseBlock(CHECK_OK); 749 ParseBlock(CHECK_OK);
750 750
751 bool catch_or_finally_seen = false; 751 bool catch_or_finally_seen = false;
752 if (peek() == i::Token::CATCH) { 752 if (peek() == i::Token::CATCH) {
753 Expect(i::Token::CATCH, CHECK_OK); 753 Consume(i::Token::CATCH);
754 Expect(i::Token::LPAREN, CHECK_OK); 754 Expect(i::Token::LPAREN, CHECK_OK);
755 ParseIdentifier(CHECK_OK); 755 ParseIdentifier(CHECK_OK);
756 Expect(i::Token::RPAREN, CHECK_OK); 756 Expect(i::Token::RPAREN, CHECK_OK);
757 scope_->EnterWith();
758 ParseBlock(ok);
759 scope_->LeaveWith();
760 if (!*ok) return kUnknownStatement;
761 catch_or_finally_seen = true;
762 }
763 if (peek() == i::Token::FINALLY) {
764 Consume(i::Token::FINALLY);
757 ParseBlock(CHECK_OK); 765 ParseBlock(CHECK_OK);
758 catch_or_finally_seen = true; 766 catch_or_finally_seen = true;
759 } 767 }
760 if (peek() == i::Token::FINALLY) {
761 Expect(i::Token::FINALLY, CHECK_OK);
762 ParseBlock(CHECK_OK);
763 catch_or_finally_seen = true;
764 }
765 if (!catch_or_finally_seen) { 768 if (!catch_or_finally_seen) {
766 *ok = false; 769 *ok = false;
767 } 770 }
768 return kUnknownStatement; 771 return kUnknownStatement;
769 } 772 }
770 773
771 774
772 template <typename Scanner, typename Log> 775 template <typename Scanner, typename Log>
773 Statement PreParser<Scanner, Log>::ParseDebuggerStatement(bool* ok) { 776 Statement PreParser<Scanner, Log>::ParseDebuggerStatement(bool* ok) {
774 // In ECMA-262 'debugger' is defined as a reserved keyword. In some browser 777 // In ECMA-262 'debugger' is defined as a reserved keyword. In some browser
(...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after
1406 *is_get = strncmp(token, "get", 3) == 0; 1409 *is_get = strncmp(token, "get", 3) == 0;
1407 *is_set = !*is_get && strncmp(token, "set", 3) == 0; 1410 *is_set = !*is_get && strncmp(token, "set", 3) == 0;
1408 } 1411 }
1409 return GetIdentifierSymbol(); 1412 return GetIdentifierSymbol();
1410 } 1413 }
1411 1414
1412 #undef CHECK_OK 1415 #undef CHECK_OK
1413 } } // v8::preparser 1416 } } // v8::preparser
1414 1417
1415 #endif // V8_PREPARSER_H 1418 #endif // V8_PREPARSER_H
OLDNEW
« no previous file with comments | « src/parser.h ('k') | test/cctest/test-parsing.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698