Chromium Code Reviews

Unified 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, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
« no previous file with comments | « src/preparser.h ('k') | src/preparser-api.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/preparser.cc
diff --git a/src/preparser.cc b/src/preparser.cc
index 157fbea554728a801d5f2e879e581f5a07d7aed5..e05f903772e6147fad2da97ef808b06d80335787 100644
--- a/src/preparser.cc
+++ b/src/preparser.cc
@@ -950,13 +950,17 @@ PreParser::Expression PreParser::ParseObjectLiteral(bool* ok) {
ParseIdentifierOrGetOrSet(&is_getter, &is_setter, CHECK_OK);
if ((is_getter || is_setter) && peek() != i::Token::COLON) {
i::Token::Value name = Next();
+ bool is_keyword = i::Token::IsKeyword(name);
if (name != i::Token::IDENTIFIER &&
name != i::Token::NUMBER &&
name != i::Token::STRING &&
- !i::Token::IsKeyword(name)) {
+ !is_keyword) {
*ok = false;
return kUnknownExpression;
}
+ if (!is_keyword) {
+ LogSymbol();
+ }
ParseFunctionLiteral(CHECK_OK);
if (peek() != i::Token::RBRACE) {
Expect(i::Token::COMMA, CHECK_OK);
@@ -1120,24 +1124,24 @@ void PreParser::ExpectSemicolon(bool* ok) {
}
-PreParser::Identifier PreParser::GetIdentifierSymbol() {
+void PreParser::LogSymbol() {
int identifier_pos = scanner_->location().beg_pos;
if (scanner_->is_literal_ascii()) {
log_->LogAsciiSymbol(identifier_pos, scanner_->literal_ascii_string());
} else {
log_->LogUC16Symbol(identifier_pos, scanner_->literal_uc16_string());
}
+}
+
+
+PreParser::Identifier PreParser::GetIdentifierSymbol() {
+ LogSymbol();
return kUnknownIdentifier;
}
PreParser::Expression PreParser::GetStringSymbol() {
- int identifier_pos = scanner_->location().beg_pos;
- if (scanner_->is_literal_ascii()) {
- log_->LogAsciiSymbol(identifier_pos, scanner_->literal_ascii_string());
- } else {
- log_->LogUC16Symbol(identifier_pos, scanner_->literal_uc16_string());
- }
+ LogSymbol();
return kUnknownExpression;
}
« no previous file with comments | « src/preparser.h ('k') | src/preparser-api.cc » ('j') | no next file with comments »

Powered by Google App Engine