Simplify PreParser::ParsePrimaryExpression

* src/preparser.cc (PreParser::ParsePrimaryExpression): No need to check
  keywords for validity as identifiers, as ParseIdentifier (called in
  the fallthrough) will take care of it.

Covered by existing tests.

BUG=

Review URL: https://codereview.chromium.org/12600004
Patch from Andy Wingo <wingo@igalia.com>.

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@13899 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent b85237a0
......@@ -1110,24 +1110,8 @@ PreParser::Expression PreParser::ParsePrimaryExpression(bool* ok) {
break;
}
case i::Token::FUTURE_RESERVED_WORD: {
Next();
i::Scanner::Location location = scanner_->location();
ReportMessageAt(location.beg_pos, location.end_pos,
"reserved_word", NULL);
*ok = false;
return Expression::Default();
}
case i::Token::FUTURE_RESERVED_WORD:
case i::Token::FUTURE_STRICT_RESERVED_WORD:
if (!is_classic_mode()) {
Next();
i::Scanner::Location location = scanner_->location();
ReportMessageAt(location, "strict_reserved_word", NULL);
*ok = false;
return Expression::Default();
}
// FALLTHROUGH
case i::Token::IDENTIFIER: {
Identifier id = ParseIdentifier(CHECK_OK);
result = Expression::FromIdentifier(id);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment