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

Unified Diff: src/parsing/preparser.cc

Issue 2311903003: Move ParseHoistableDeclaration to ParserBase. (Closed)
Patch Set: rebased 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 c65a0a58ff21f979824374c4059f705ae71dbd2c..027b75deda3bfd54f12a6d2a1ea149118ac128a9 100644
--- a/src/parsing/preparser.cc
+++ b/src/parsing/preparser.cc
@@ -121,28 +121,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::ParseHoistableDeclaration(
- int pos, ParseFunctionFlags flags, ZoneList<const AstRawString*>* names,
- bool default_export, bool* ok) {
- const bool is_generator = flags & ParseFunctionFlags::kIsGenerator;
- const bool is_async = flags & ParseFunctionFlags::kIsAsync;
- DCHECK(!is_generator || !is_async);
-
- bool is_strict_reserved = false;
- Identifier name = ParseIdentifierOrStrictReservedWord(
- &is_strict_reserved, CHECK_OK);
-
- ParseFunctionLiteral(name, scanner()->location(),
- is_strict_reserved ? kFunctionNameIsStrictReserved
- : kFunctionNameValidityUnknown,
- is_generator ? FunctionKind::kGeneratorFunction
- : is_async ? FunctionKind::kAsyncFunction
- : FunctionKind::kNormalFunction,
- pos, FunctionLiteral::kDeclaration, language_mode(),
- CHECK_OK);
- return Statement::FunctionDeclaration();
-}
-
PreParser::Statement PreParser::ParseAsyncFunctionDeclaration(
ZoneList<const AstRawString*>* names, bool default_export, bool* ok) {
// AsyncFunctionDeclaration ::
@@ -155,23 +133,6 @@ PreParser::Statement PreParser::ParseAsyncFunctionDeclaration(
return ParseHoistableDeclaration(pos, flags, names, default_export, ok);
}
-PreParser::Statement PreParser::ParseHoistableDeclaration(
- ZoneList<const AstRawString*>* names, bool default_export, bool* ok) {
- // FunctionDeclaration ::
- // 'function' Identifier '(' FormalParameterListopt ')' '{' FunctionBody '}'
- // GeneratorDeclaration ::
- // 'function' '*' Identifier '(' FormalParameterListopt ')'
- // '{' FunctionBody '}'
-
- Expect(Token::FUNCTION, CHECK_OK);
- int pos = position();
- ParseFunctionFlags flags = ParseFunctionFlags::kIsNormal;
- if (Check(Token::MUL)) {
- flags |= ParseFunctionFlags::kIsGenerator;
- }
- return ParseHoistableDeclaration(pos, flags, names, default_export, ok);
-}
-
PreParser::Statement PreParser::ParseClassDeclaration(
ZoneList<const AstRawString*>* names, bool default_export, bool* ok) {
int pos = position();
@@ -197,6 +158,9 @@ PreParser::Statement PreParser::ParseFunctionDeclaration(bool* ok) {
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);
}
« 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