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

Unified Diff: src/parsing/parser.h

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 | « no previous file | src/parsing/parser.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parsing/parser.h
diff --git a/src/parsing/parser.h b/src/parsing/parser.h
index af530339d0d0d291989e17d265716211371f02c4..86680e1683d713dcb112b0cafe99cdc7cd1723f6 100644
--- a/src/parsing/parser.h
+++ b/src/parsing/parser.h
@@ -152,7 +152,8 @@ struct ParserTypes<Parser> {
typedef ObjectLiteral::Property* ObjectLiteralProperty;
typedef ClassLiteral::Property* ClassLiteralProperty;
typedef ZoneList<v8::internal::Expression*>* ExpressionList;
- typedef ZoneList<ObjectLiteral::Property*>* PropertyList;
+ typedef ZoneList<ObjectLiteral::Property*>* ObjectPropertyList;
+ typedef ZoneList<ClassLiteral::Property*>* ClassPropertyList;
typedef ParserFormalParameters FormalParameters;
typedef v8::internal::Statement* Statement;
typedef ZoneList<v8::internal::Statement*>* StatementList;
@@ -269,9 +270,6 @@ class Parser : public ParserBase<Parser> {
};
ZoneList<const NamedImport*>* ParseNamedImports(int pos, bool* ok);
Statement* ParseFunctionDeclaration(bool* ok);
- Statement* ParseClassDeclaration(ZoneList<const AstRawString*>* names,
- bool default_export, bool* ok);
- Statement* ParseNativeDeclaration(bool* ok);
Block* BuildInitializationBlock(DeclarationParsingResult* parsing_result,
ZoneList<const AstRawString*>* names,
bool* ok);
@@ -297,6 +295,21 @@ class Parser : public ParserBase<Parser> {
FunctionLiteral* function, int pos,
bool is_generator, bool is_async,
ZoneList<const AstRawString*>* names, bool* ok);
+ V8_INLINE Statement* DeclareClass(const AstRawString* variable_name,
+ Expression* value,
+ ZoneList<const AstRawString*>* names,
+ int class_token_pos, int end_pos, bool* ok);
+ V8_INLINE void DeclareClassVariable(const AstRawString* name,
+ Scope* block_scope, ClassInfo* class_info,
+ int class_token_pos, bool* ok);
+ V8_INLINE void DeclareClassProperty(const AstRawString* class_name,
+ ClassLiteralProperty* property,
+ ClassInfo* class_info, bool* ok);
+ V8_INLINE Expression* RewriteClassLiteral(const AstRawString* name,
+ ClassInfo* class_info, int pos,
+ bool* ok);
+ V8_INLINE Statement* DeclareNative(const AstRawString* name, int pos,
+ bool* ok);
Expression* ParseYieldStarExpression(bool* ok);
@@ -419,11 +432,6 @@ class Parser : public ParserBase<Parser> {
FunctionLiteral* SynthesizeClassFieldInitializer(int count);
FunctionLiteral* InsertClassFieldInitializer(FunctionLiteral* constructor);
- Expression* ParseClassLiteral(const AstRawString* name,
- Scanner::Location class_name_location,
- bool name_is_strict_reserved, int pos,
- bool* ok);
-
// Get odd-ball literals.
Literal* GetLiteralUndefined(int position);
@@ -739,10 +747,16 @@ class Parser : public ParserBase<Parser> {
fni_->PushEnclosingName(name);
}
- V8_INLINE void InferFunctionName(FunctionLiteral* func_to_infer) {
+ V8_INLINE void AddFunctionForNameInference(FunctionLiteral* func_to_infer) {
+ DCHECK_NOT_NULL(fni_);
fni_->AddFunction(func_to_infer);
}
+ V8_INLINE void InferFunctionName() {
+ DCHECK_NOT_NULL(fni_);
+ fni_->Infer();
+ }
+
// If we assign a function literal to a property we pretenure the
// literal so it can be added as a constant function property.
V8_INLINE static void CheckAssigningFunctionLiteralToProperty(
@@ -936,7 +950,7 @@ class Parser : public ParserBase<Parser> {
V8_INLINE ZoneList<Expression*>* NewExpressionList(int size) const {
return new (zone()) ZoneList<Expression*>(size, zone());
}
- V8_INLINE ZoneList<ObjectLiteral::Property*>* NewPropertyList(
+ V8_INLINE ZoneList<ObjectLiteral::Property*>* NewObjectPropertyList(
int size) const {
return new (zone()) ZoneList<ObjectLiteral::Property*>(size, zone());
}
« no previous file with comments | « no previous file | src/parsing/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698