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

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
« src/parsing/preparser.h ('K') | « 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 4a3f680f035d1384bb8d445bf5b40ec5b4ee2910..d7f95e181fc40678811e5629463f06453bdf99d0 100644
--- a/src/parsing/preparser.cc
+++ b/src/parsing/preparser.cc
@@ -132,28 +132,6 @@ PreParser::Statement PreParser::ParseScopedStatement(bool legacy, bool* ok) {
}
}
-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 ::
@@ -166,23 +144,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();
@@ -237,6 +198,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);
}
« src/parsing/preparser.h ('K') | « src/parsing/preparser.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698