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,
PreParserIdentifier PreParserTraits::GetSymbol(Scanner* scanner) {
if (scanner->current_token() == Token::ENUM) {
return PreParserIdentifier::Enum();
} else if (scanner->current_token() == Token::AWAIT) {
return PreParserIdentifier::Await();
} else if (scanner->current_token() ==
Token::FUTURE_STRICT_RESERVED_WORD) {
return PreParserIdentifier::FutureStrictReserved();
} else if (scanner->current_token() == Token::LET) {
return PreParserIdentifier::Let();
} else if (scanner->current_token() == Token::STATIC) {
return PreParserIdentifier::Static();
} else if (scanner->current_token() == Token::YIELD) {
return PreParserIdentifier::Yield();
} else if (scanner->current_token() == Token::ASYNC) {
return PreParserIdentifier::Async();
}
if (scanner->UnescapedLiteralMatches("eval", 4)) {
return PreParserIdentifier::Eval();
}
if (scanner->UnescapedLiteralMatches("arguments", 9)) {
return PreParserIdentifier::Arguments();
}
if (scanner->UnescapedLiteralMatches("undefined", 9)) {
return PreParserIdentifier::Undefined();
}
if (scanner->LiteralMatches("prototype", 9)) {
return PreParserIdentifier::Prototype();
}
if (scanner->LiteralMatches("constructor", 11)) {
return PreParserIdentifier::Constructor();
switch (scanner->current_token()) {
case Token::ENUM:
return PreParserIdentifier::Enum();
case Token::AWAIT:
return PreParserIdentifier::Await();
case Token::FUTURE_STRICT_RESERVED_WORD:
return PreParserIdentifier::FutureStrictReserved();
case Token::LET:
return PreParserIdentifier::Let();
case Token::STATIC:
return PreParserIdentifier::Static();
case Token::YIELD:
return PreParserIdentifier::Yield();
case Token::ASYNC:
return PreParserIdentifier::Async();
default:
if (scanner->UnescapedLiteralMatches("eval", 4))
return PreParserIdentifier::Eval();
if (scanner->UnescapedLiteralMatches("arguments", 9))
return PreParserIdentifier::Arguments();
if (scanner->UnescapedLiteralMatches("undefined", 9))
return PreParserIdentifier::Undefined();
if (scanner->LiteralMatches("prototype", 9))
return PreParserIdentifier::Prototype();
if (scanner->LiteralMatches("constructor", 11))
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