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

Side by Side Diff: src/preparser.cc

Issue 5985010: Fix compile-problem in (currently) unused stand-alone preparser function. (Closed)
Patch Set: Addressed review comment Created 9 years, 11 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 | « src/preparser.h ('k') | src/preparser-api.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 932 matching lines...) Expand 10 before | Expand all | Expand 10 after
943 Expect(i::Token::LBRACE, CHECK_OK); 943 Expect(i::Token::LBRACE, CHECK_OK);
944 while (peek() != i::Token::RBRACE) { 944 while (peek() != i::Token::RBRACE) {
945 i::Token::Value next = peek(); 945 i::Token::Value next = peek();
946 switch (next) { 946 switch (next) {
947 case i::Token::IDENTIFIER: { 947 case i::Token::IDENTIFIER: {
948 bool is_getter = false; 948 bool is_getter = false;
949 bool is_setter = false; 949 bool is_setter = false;
950 ParseIdentifierOrGetOrSet(&is_getter, &is_setter, CHECK_OK); 950 ParseIdentifierOrGetOrSet(&is_getter, &is_setter, CHECK_OK);
951 if ((is_getter || is_setter) && peek() != i::Token::COLON) { 951 if ((is_getter || is_setter) && peek() != i::Token::COLON) {
952 i::Token::Value name = Next(); 952 i::Token::Value name = Next();
953 bool is_keyword = i::Token::IsKeyword(name);
953 if (name != i::Token::IDENTIFIER && 954 if (name != i::Token::IDENTIFIER &&
954 name != i::Token::NUMBER && 955 name != i::Token::NUMBER &&
955 name != i::Token::STRING && 956 name != i::Token::STRING &&
956 !i::Token::IsKeyword(name)) { 957 !is_keyword) {
957 *ok = false; 958 *ok = false;
958 return kUnknownExpression; 959 return kUnknownExpression;
959 } 960 }
961 if (!is_keyword) {
962 LogSymbol();
963 }
960 ParseFunctionLiteral(CHECK_OK); 964 ParseFunctionLiteral(CHECK_OK);
961 if (peek() != i::Token::RBRACE) { 965 if (peek() != i::Token::RBRACE) {
962 Expect(i::Token::COMMA, CHECK_OK); 966 Expect(i::Token::COMMA, CHECK_OK);
963 } 967 }
964 continue; // restart the while 968 continue; // restart the while
965 } 969 }
966 break; 970 break;
967 } 971 }
968 case i::Token::STRING: 972 case i::Token::STRING:
969 Consume(next); 973 Consume(next);
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
1113 } 1117 }
1114 if (scanner_->has_line_terminator_before_next() || 1118 if (scanner_->has_line_terminator_before_next() ||
1115 tok == i::Token::RBRACE || 1119 tok == i::Token::RBRACE ||
1116 tok == i::Token::EOS) { 1120 tok == i::Token::EOS) {
1117 return; 1121 return;
1118 } 1122 }
1119 Expect(i::Token::SEMICOLON, ok); 1123 Expect(i::Token::SEMICOLON, ok);
1120 } 1124 }
1121 1125
1122 1126
1123 PreParser::Identifier PreParser::GetIdentifierSymbol() { 1127 void PreParser::LogSymbol() {
1124 int identifier_pos = scanner_->location().beg_pos; 1128 int identifier_pos = scanner_->location().beg_pos;
1125 if (scanner_->is_literal_ascii()) { 1129 if (scanner_->is_literal_ascii()) {
1126 log_->LogAsciiSymbol(identifier_pos, scanner_->literal_ascii_string()); 1130 log_->LogAsciiSymbol(identifier_pos, scanner_->literal_ascii_string());
1127 } else { 1131 } else {
1128 log_->LogUC16Symbol(identifier_pos, scanner_->literal_uc16_string()); 1132 log_->LogUC16Symbol(identifier_pos, scanner_->literal_uc16_string());
1129 } 1133 }
1134 }
1135
1136
1137 PreParser::Identifier PreParser::GetIdentifierSymbol() {
1138 LogSymbol();
1130 return kUnknownIdentifier; 1139 return kUnknownIdentifier;
1131 } 1140 }
1132 1141
1133 1142
1134 PreParser::Expression PreParser::GetStringSymbol() { 1143 PreParser::Expression PreParser::GetStringSymbol() {
1135 int identifier_pos = scanner_->location().beg_pos; 1144 LogSymbol();
1136 if (scanner_->is_literal_ascii()) {
1137 log_->LogAsciiSymbol(identifier_pos, scanner_->literal_ascii_string());
1138 } else {
1139 log_->LogUC16Symbol(identifier_pos, scanner_->literal_uc16_string());
1140 }
1141 return kUnknownExpression; 1145 return kUnknownExpression;
1142 } 1146 }
1143 1147
1144 1148
1145 PreParser::Identifier PreParser::ParseIdentifier(bool* ok) { 1149 PreParser::Identifier PreParser::ParseIdentifier(bool* ok) {
1146 Expect(i::Token::IDENTIFIER, ok); 1150 Expect(i::Token::IDENTIFIER, ok);
1147 if (!*ok) return kUnknownIdentifier; 1151 if (!*ok) return kUnknownIdentifier;
1148 return GetIdentifierSymbol(); 1152 return GetIdentifierSymbol();
1149 } 1153 }
1150 1154
(...skipping 26 matching lines...) Expand all
1177 if (scanner_->is_literal_ascii() && scanner_->literal_length() == 3) { 1181 if (scanner_->is_literal_ascii() && scanner_->literal_length() == 3) {
1178 const char* token = scanner_->literal_ascii_string().start(); 1182 const char* token = scanner_->literal_ascii_string().start();
1179 *is_get = strncmp(token, "get", 3) == 0; 1183 *is_get = strncmp(token, "get", 3) == 0;
1180 *is_set = !*is_get && strncmp(token, "set", 3) == 0; 1184 *is_set = !*is_get && strncmp(token, "set", 3) == 0;
1181 } 1185 }
1182 return GetIdentifierSymbol(); 1186 return GetIdentifierSymbol();
1183 } 1187 }
1184 1188
1185 #undef CHECK_OK 1189 #undef CHECK_OK
1186 } } // v8::preparser 1190 } } // v8::preparser
OLDNEW
« no previous file with comments | « src/preparser.h ('k') | src/preparser-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698