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

Unified Diff: src/parsing/preparser.cc

Issue 2376293002: [parser] Refactor of ParseFunctionDeclaration (Closed)
Patch Set: The real patch Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/parsing/preparser.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parsing/preparser.cc
diff --git a/src/parsing/preparser.cc b/src/parsing/preparser.cc
index c255285e9f67b2a7ec826d1505beabee38ac85a7..963edcc7ab0c6bb15cbcf6873803c31ff012053d 100644
--- a/src/parsing/preparser.cc
+++ b/src/parsing/preparser.cc
@@ -35,7 +35,7 @@ namespace internal {
#define DUMMY ) // to make indentation work
#undef DUMMY
-#define CHECK_OK CHECK_OK_VALUE(Statement::Default())
+#define CHECK_OK CHECK_OK_VALUE(Expression::Default())
#define CHECK_OK_VOID CHECK_OK_VALUE(this->Void())
namespace {
@@ -135,29 +135,6 @@ PreParser::PreParseResult PreParser::PreParseLazyFunction(
// That means that contextual checks (like a label being declared where
// it is used) are generally omitted.
-PreParser::Statement PreParser::ParseFunctionDeclaration(bool* ok) {
- Consume(Token::FUNCTION);
- int pos = position();
- ParseFunctionFlags flags = ParseFunctionFlags::kIsNormal;
- if (Check(Token::MUL)) {
- flags |= ParseFunctionFlags::kIsGenerator;
- if (allow_harmony_restrictive_declarations()) {
- ReportMessageAt(scanner()->location(),
- MessageTemplate::kGeneratorInLegacyContext);
- *ok = false;
- return Statement::Default();
- }
- }
- // PreParser is not able to parse "export default" yet (since PreParser is
- // at the moment only used for functions, and it cannot occur
- // there). TODO(marja): update this when it is.
- return ParseHoistableDeclaration(pos, flags, nullptr, false, ok);
-}
-
-// Redefinition of CHECK_OK for parsing expressions.
-#undef CHECK_OK
-#define CHECK_OK CHECK_OK_VALUE(Expression::Default())
-
PreParser::Expression PreParser::ParseFunctionLiteral(
Identifier function_name, Scanner::Location function_name_location,
FunctionNameValidity function_name_validity, FunctionKind kind,
« no previous file with comments | « src/parsing/preparser.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698