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

Unified Diff: src/parsing/preparser.cc

Issue 2368083002: [parser] Refactor of ParseClass* and ParseNativeDeclaration (Closed)
Patch Set: Rebase again 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 d4438b8d696722c1e3dae4180fde1386f519706e..c255285e9f67b2a7ec826d1505beabee38ac85a7 100644
--- a/src/parsing/preparser.cc
+++ b/src/parsing/preparser.cc
@@ -135,18 +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::ParseClassDeclaration(
- ZoneList<const AstRawString*>* names, bool default_export, bool* ok) {
- int pos = position();
- bool is_strict_reserved = false;
- Identifier name =
- ParseIdentifierOrStrictReservedWord(&is_strict_reserved, CHECK_OK);
- ExpressionClassifier no_classifier(this);
- ParseClassLiteral(name, scanner()->location(), is_strict_reserved, pos,
- CHECK_OK);
- return Statement::Default();
-}
-
PreParser::Statement PreParser::ParseFunctionDeclaration(bool* ok) {
Consume(Token::FUNCTION);
int pos = position();
@@ -251,57 +239,6 @@ PreParser::LazyParsingResult PreParser::ParseLazyFunctionLiteralBody(
return kLazyParsingComplete;
}
-PreParserExpression PreParser::ParseClassLiteral(
- PreParserIdentifier name, Scanner::Location class_name_location,
- bool name_is_strict_reserved, int pos, bool* ok) {
- // All parts of a ClassDeclaration and ClassExpression are strict code.
- if (name_is_strict_reserved) {
- ReportMessageAt(class_name_location,
- MessageTemplate::kUnexpectedStrictReserved);
- *ok = false;
- return EmptyExpression();
- }
- if (IsEvalOrArguments(name)) {
- ReportMessageAt(class_name_location, MessageTemplate::kStrictEvalArguments);
- *ok = false;
- return EmptyExpression();
- }
-
- LanguageMode class_language_mode = language_mode();
- BlockState block_state(zone(), &scope_state_);
- scope()->SetLanguageMode(
- static_cast<LanguageMode>(class_language_mode | STRICT));
- // TODO(marja): Make PreParser use scope names too.
- // this->scope()->SetScopeName(name);
-
- bool has_extends = Check(Token::EXTENDS);
- if (has_extends) {
- ExpressionClassifier extends_classifier(this);
- ParseLeftHandSideExpression(CHECK_OK);
- ValidateExpression(CHECK_OK);
- impl()->AccumulateFormalParameterContainmentErrors();
- }
-
- ClassLiteralChecker checker(this);
- bool has_seen_constructor = false;
-
- Expect(Token::LBRACE, CHECK_OK);
- while (peek() != Token::RBRACE) {
- if (Check(Token::SEMICOLON)) continue;
- bool is_computed_name = false; // Classes do not care about computed
- // property names here.
- ExpressionClassifier property_classifier(this);
- ParseClassPropertyDefinition(&checker, has_extends, &is_computed_name,
- &has_seen_constructor, CHECK_OK);
- ValidateExpression(CHECK_OK);
- impl()->AccumulateFormalParameterContainmentErrors();
- }
-
- Expect(Token::RBRACE, CHECK_OK);
-
- return Expression::Default();
-}
-
PreParserExpression PreParser::ExpressionFromIdentifier(
PreParserIdentifier name, int start_position, int end_position,
InferName infer) {
« 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