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

Side by Side Diff: src/preparser.cc

Issue 12600004: Simplify PreParser::ParsePrimaryExpression (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: Created 7 years, 9 months 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1092 matching lines...) Expand 10 before | Expand all | Expand 10 after
1103 // '(' Expression ')' 1103 // '(' Expression ')'
1104 1104
1105 Expression result = Expression::Default(); 1105 Expression result = Expression::Default();
1106 switch (peek()) { 1106 switch (peek()) {
1107 case i::Token::THIS: { 1107 case i::Token::THIS: {
1108 Next(); 1108 Next();
1109 result = Expression::This(); 1109 result = Expression::This();
1110 break; 1110 break;
1111 } 1111 }
1112 1112
1113 case i::Token::FUTURE_RESERVED_WORD: { 1113 case i::Token::FUTURE_RESERVED_WORD:
1114 Next();
1115 i::Scanner::Location location = scanner_->location();
1116 ReportMessageAt(location.beg_pos, location.end_pos,
1117 "reserved_word", NULL);
1118 *ok = false;
1119 return Expression::Default();
1120 }
1121
1122 case i::Token::FUTURE_STRICT_RESERVED_WORD: 1114 case i::Token::FUTURE_STRICT_RESERVED_WORD:
1123 if (!is_classic_mode()) {
1124 Next();
1125 i::Scanner::Location location = scanner_->location();
1126 ReportMessageAt(location, "strict_reserved_word", NULL);
1127 *ok = false;
1128 return Expression::Default();
1129 }
1130 // FALLTHROUGH
1131 case i::Token::IDENTIFIER: { 1115 case i::Token::IDENTIFIER: {
1132 Identifier id = ParseIdentifier(CHECK_OK); 1116 Identifier id = ParseIdentifier(CHECK_OK);
1133 result = Expression::FromIdentifier(id); 1117 result = Expression::FromIdentifier(id);
1134 break; 1118 break;
1135 } 1119 }
1136 1120
1137 case i::Token::NULL_LITERAL: 1121 case i::Token::NULL_LITERAL:
1138 case i::Token::TRUE_LITERAL: 1122 case i::Token::TRUE_LITERAL:
1139 case i::Token::FALSE_LITERAL: 1123 case i::Token::FALSE_LITERAL:
1140 case i::Token::NUMBER: { 1124 case i::Token::NUMBER: {
(...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after
1780 backing_store_.Add(static_cast<byte>((ascii_length >> 14) | 0x80u)); 1764 backing_store_.Add(static_cast<byte>((ascii_length >> 14) | 0x80u));
1781 } 1765 }
1782 backing_store_.Add(static_cast<byte>((ascii_length >> 7) | 0x80u)); 1766 backing_store_.Add(static_cast<byte>((ascii_length >> 7) | 0x80u));
1783 } 1767 }
1784 backing_store_.Add(static_cast<byte>(ascii_length & 0x7f)); 1768 backing_store_.Add(static_cast<byte>(ascii_length & 0x7f));
1785 1769
1786 backing_store_.AddBlock(bytes); 1770 backing_store_.AddBlock(bytes);
1787 return backing_store_.EndSequence().start(); 1771 return backing_store_.EndSequence().start();
1788 } 1772 }
1789 } } // v8::preparser 1773 } } // v8::preparser
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698