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

Side by Side Diff: src/parsing/parser.h

Issue 2302643002: Split the AST representation of class properties from object properties (Closed)
Patch Set: remove spurious classliteralproperty typedef 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 unified diff | Download patch
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_PARSING_PARSER_H_ 5 #ifndef V8_PARSING_PARSER_H_
6 #define V8_PARSING_PARSER_H_ 6 #define V8_PARSING_PARSER_H_
7 7
8 #include "src/ast/ast.h" 8 #include "src/ast/ast.h"
9 #include "src/ast/scopes.h" 9 #include "src/ast/scopes.h"
10 #include "src/parsing/parser-base.h" 10 #include "src/parsing/parser-base.h"
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 typedef ParserBase<Parser> Base; 142 typedef ParserBase<Parser> Base;
143 typedef Parser Impl; 143 typedef Parser Impl;
144 144
145 typedef Variable GeneratorVariable; 145 typedef Variable GeneratorVariable;
146 146
147 // Return types for traversing functions. 147 // Return types for traversing functions.
148 typedef const AstRawString* Identifier; 148 typedef const AstRawString* Identifier;
149 typedef v8::internal::Expression* Expression; 149 typedef v8::internal::Expression* Expression;
150 typedef v8::internal::FunctionLiteral* FunctionLiteral; 150 typedef v8::internal::FunctionLiteral* FunctionLiteral;
151 typedef ObjectLiteral::Property* ObjectLiteralProperty; 151 typedef ObjectLiteral::Property* ObjectLiteralProperty;
152 typedef ClassLiteral::Property* ClassLiteralProperty;
152 typedef ZoneList<v8::internal::Expression*>* ExpressionList; 153 typedef ZoneList<v8::internal::Expression*>* ExpressionList;
153 typedef ZoneList<ObjectLiteral::Property*>* PropertyList; 154 typedef ZoneList<ObjectLiteral::Property*>* PropertyList;
154 typedef ParserFormalParameters FormalParameters; 155 typedef ParserFormalParameters FormalParameters;
155 typedef ZoneList<v8::internal::Statement*>* StatementList; 156 typedef ZoneList<v8::internal::Statement*>* StatementList;
156 typedef v8::internal::Block* Block; 157 typedef v8::internal::Block* Block;
157 158
158 // For constructing objects returned by the traversing functions. 159 // For constructing objects returned by the traversing functions.
159 typedef AstNodeFactory Factory; 160 typedef AstNodeFactory Factory;
160 }; 161 };
161 162
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after
700 V8_INLINE static bool IsArrayIndex(const AstRawString* string, 701 V8_INLINE static bool IsArrayIndex(const AstRawString* string,
701 uint32_t* index) { 702 uint32_t* index) {
702 return string->AsArrayIndex(index); 703 return string->AsArrayIndex(index);
703 } 704 }
704 705
705 V8_INLINE static Expression* GetPropertyValue( 706 V8_INLINE static Expression* GetPropertyValue(
706 ObjectLiteral::Property* property) { 707 ObjectLiteral::Property* property) {
707 return property->value(); 708 return property->value();
708 } 709 }
709 710
711 V8_INLINE static Expression* GetPropertyValue(
adamk 2016/09/01 21:18:23 Can't you just take a LiteralProperty* instead?
bakkot 2016/09/01 23:24:31 Whoops. Done.
712 ClassLiteral::Property* property) {
713 return property->value();
714 }
715
710 // Functions for encapsulating the differences between parsing and preparsing; 716 // Functions for encapsulating the differences between parsing and preparsing;
711 // operations interleaved with the recursive descent. 717 // operations interleaved with the recursive descent.
712 V8_INLINE static void PushLiteralName(FuncNameInferrer* fni, 718 V8_INLINE static void PushLiteralName(FuncNameInferrer* fni,
713 const AstRawString* id) { 719 const AstRawString* id) {
714 fni->PushLiteralName(id); 720 fni->PushLiteralName(id);
715 } 721 }
716 722
717 V8_INLINE static void PushVariableName(FuncNameInferrer* fni, 723 V8_INLINE static void PushVariableName(FuncNameInferrer* fni,
718 const AstRawString* id) { 724 const AstRawString* id) {
719 fni->PushVariableName(id); 725 fni->PushVariableName(id);
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
830 arg, error_type); 836 arg, error_type);
831 } 837 }
832 838
833 // "null" return type creators. 839 // "null" return type creators.
834 V8_INLINE static const AstRawString* EmptyIdentifier() { return nullptr; } 840 V8_INLINE static const AstRawString* EmptyIdentifier() { return nullptr; }
835 V8_INLINE static Expression* EmptyExpression() { return nullptr; } 841 V8_INLINE static Expression* EmptyExpression() { return nullptr; }
836 V8_INLINE static Literal* EmptyLiteral() { return nullptr; } 842 V8_INLINE static Literal* EmptyLiteral() { return nullptr; }
837 V8_INLINE static ObjectLiteralProperty* EmptyObjectLiteralProperty() { 843 V8_INLINE static ObjectLiteralProperty* EmptyObjectLiteralProperty() {
838 return nullptr; 844 return nullptr;
839 } 845 }
846 V8_INLINE static ClassLiteralProperty* EmptyClassLiteralProperty() {
847 return nullptr;
848 }
840 V8_INLINE static FunctionLiteral* EmptyFunctionLiteral() { return nullptr; } 849 V8_INLINE static FunctionLiteral* EmptyFunctionLiteral() { return nullptr; }
841 V8_INLINE static Block* NullBlock() { return nullptr; } 850 V8_INLINE static Block* NullBlock() { return nullptr; }
842 851
843 V8_INLINE static bool IsEmptyExpression(Expression* expr) { 852 V8_INLINE static bool IsEmptyExpression(Expression* expr) {
844 return expr == nullptr; 853 return expr == nullptr;
845 } 854 }
846 855
847 // Used in error return values. 856 // Used in error return values.
848 V8_INLINE static ZoneList<Expression*>* NullExpressionList() { 857 V8_INLINE static ZoneList<Expression*>* NullExpressionList() {
849 return nullptr; 858 return nullptr;
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
905 return factory()->NewStringLiteral(symbol, pos); 914 return factory()->NewStringLiteral(symbol, pos);
906 } 915 }
907 916
908 V8_INLINE ZoneList<Expression*>* NewExpressionList(int size) const { 917 V8_INLINE ZoneList<Expression*>* NewExpressionList(int size) const {
909 return new (zone()) ZoneList<Expression*>(size, zone()); 918 return new (zone()) ZoneList<Expression*>(size, zone());
910 } 919 }
911 V8_INLINE ZoneList<ObjectLiteral::Property*>* NewPropertyList( 920 V8_INLINE ZoneList<ObjectLiteral::Property*>* NewPropertyList(
912 int size) const { 921 int size) const {
913 return new (zone()) ZoneList<ObjectLiteral::Property*>(size, zone()); 922 return new (zone()) ZoneList<ObjectLiteral::Property*>(size, zone());
914 } 923 }
924 V8_INLINE ZoneList<ClassLiteral::Property*>* NewClassPropertyList(
925 int size) const {
926 return new (zone()) ZoneList<ClassLiteral::Property*>(size, zone());
927 }
915 V8_INLINE ZoneList<Statement*>* NewStatementList(int size) const { 928 V8_INLINE ZoneList<Statement*>* NewStatementList(int size) const {
916 return new (zone()) ZoneList<Statement*>(size, zone()); 929 return new (zone()) ZoneList<Statement*>(size, zone());
917 } 930 }
918 931
919 V8_INLINE Block* NewBlock(ZoneList<const AstRawString*>* labels, int capacity, 932 V8_INLINE Block* NewBlock(ZoneList<const AstRawString*>* labels, int capacity,
920 bool ignore_completion_value, int pos) { 933 bool ignore_completion_value, int pos) {
921 return factory()->NewBlock(labels, capacity, ignore_completion_value, pos); 934 return factory()->NewBlock(labels, capacity, ignore_completion_value, pos);
922 } 935 }
923 936
924 V8_INLINE void AddParameterInitializationBlock( 937 V8_INLINE void AddParameterInitializationBlock(
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
985 V8_INLINE static bool IsTaggedTemplate(const Expression* tag) { 998 V8_INLINE static bool IsTaggedTemplate(const Expression* tag) {
986 return tag != NULL; 999 return tag != NULL;
987 } 1000 }
988 1001
989 V8_INLINE void MaterializeUnspreadArgumentsLiterals(int count) {} 1002 V8_INLINE void MaterializeUnspreadArgumentsLiterals(int count) {}
990 1003
991 Expression* ExpressionListToExpression(ZoneList<Expression*>* args); 1004 Expression* ExpressionListToExpression(ZoneList<Expression*>* args);
992 1005
993 void SetFunctionNameFromPropertyName(ObjectLiteralProperty* property, 1006 void SetFunctionNameFromPropertyName(ObjectLiteralProperty* property,
994 const AstRawString* name); 1007 const AstRawString* name);
1008 void SetFunctionNameFromPropertyName(ClassLiteralProperty* property,
1009 const AstRawString* name);
995 1010
996 void SetFunctionNameFromIdentifierRef(Expression* value, 1011 void SetFunctionNameFromIdentifierRef(Expression* value,
997 Expression* identifier); 1012 Expression* identifier);
998 1013
999 V8_INLINE ZoneList<typename ExpressionClassifier::Error>* 1014 V8_INLINE ZoneList<typename ExpressionClassifier::Error>*
1000 GetReportedErrorList() const { 1015 GetReportedErrorList() const {
1001 return function_state_->GetReportedErrorList(); 1016 return function_state_->GetReportedErrorList();
1002 } 1017 }
1003 1018
1004 V8_INLINE ZoneList<Expression*>* GetNonPatternList() const { 1019 V8_INLINE ZoneList<Expression*>* GetNonPatternList() const {
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
1055 static const int kLiteralTypeSlot = 0; 1070 static const int kLiteralTypeSlot = 0;
1056 static const int kElementsSlot = 1; 1071 static const int kElementsSlot = 1;
1057 1072
1058 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); 1073 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue);
1059 }; 1074 };
1060 1075
1061 } // namespace internal 1076 } // namespace internal
1062 } // namespace v8 1077 } // namespace v8
1063 1078
1064 #endif // V8_PARSING_PARSER_H_ 1079 #endif // V8_PARSING_PARSER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698