Commit ed08838e authored by nikolaos's avatar nikolaos Committed by Commit bot

[parser] Refactor preparser GetSymbol

R=adamk@chromium.org, marja@chromium.org
BUG=
LOG=N

Review-Url: https://codereview.chromium.org/2256163002
Cr-Commit-Position: refs/heads/master@{#38738}
parent ff010282
...@@ -58,38 +58,34 @@ void PreParserTraits::ReportMessageAt(Scanner::Location location, ...@@ -58,38 +58,34 @@ void PreParserTraits::ReportMessageAt(Scanner::Location location,
PreParserIdentifier PreParserTraits::GetSymbol(Scanner* scanner) { PreParserIdentifier PreParserTraits::GetSymbol(Scanner* scanner) {
if (scanner->current_token() == Token::ENUM) { switch (scanner->current_token()) {
case Token::ENUM:
return PreParserIdentifier::Enum(); return PreParserIdentifier::Enum();
} else if (scanner->current_token() == Token::AWAIT) { case Token::AWAIT:
return PreParserIdentifier::Await(); return PreParserIdentifier::Await();
} else if (scanner->current_token() == case Token::FUTURE_STRICT_RESERVED_WORD:
Token::FUTURE_STRICT_RESERVED_WORD) {
return PreParserIdentifier::FutureStrictReserved(); return PreParserIdentifier::FutureStrictReserved();
} else if (scanner->current_token() == Token::LET) { case Token::LET:
return PreParserIdentifier::Let(); return PreParserIdentifier::Let();
} else if (scanner->current_token() == Token::STATIC) { case Token::STATIC:
return PreParserIdentifier::Static(); return PreParserIdentifier::Static();
} else if (scanner->current_token() == Token::YIELD) { case Token::YIELD:
return PreParserIdentifier::Yield(); return PreParserIdentifier::Yield();
} else if (scanner->current_token() == Token::ASYNC) { case Token::ASYNC:
return PreParserIdentifier::Async(); return PreParserIdentifier::Async();
} default:
if (scanner->UnescapedLiteralMatches("eval", 4)) { if (scanner->UnescapedLiteralMatches("eval", 4))
return PreParserIdentifier::Eval(); return PreParserIdentifier::Eval();
} if (scanner->UnescapedLiteralMatches("arguments", 9))
if (scanner->UnescapedLiteralMatches("arguments", 9)) {
return PreParserIdentifier::Arguments(); return PreParserIdentifier::Arguments();
} if (scanner->UnescapedLiteralMatches("undefined", 9))
if (scanner->UnescapedLiteralMatches("undefined", 9)) {
return PreParserIdentifier::Undefined(); return PreParserIdentifier::Undefined();
} if (scanner->LiteralMatches("prototype", 9))
if (scanner->LiteralMatches("prototype", 9)) {
return PreParserIdentifier::Prototype(); return PreParserIdentifier::Prototype();
} if (scanner->LiteralMatches("constructor", 11))
if (scanner->LiteralMatches("constructor", 11)) {
return PreParserIdentifier::Constructor(); return PreParserIdentifier::Constructor();
}
return PreParserIdentifier::Default(); return PreParserIdentifier::Default();
}
} }
......
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