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

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

Issue 2258123002: [parser] Refactor parser and preparser traits (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@nickie-2264483003-ord-traits
Patch Set: Created 4 years, 4 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
« no previous file with comments | « src/parsing/parser-base.h ('k') | src/parsing/preparser.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_PREPARSER_H 5 #ifndef V8_PARSING_PREPARSER_H
6 #define V8_PARSING_PREPARSER_H 6 #define V8_PARSING_PREPARSER_H
7 7
8 #include "src/ast/scopes.h" 8 #include "src/ast/scopes.h"
9 #include "src/bailout-reason.h" 9 #include "src/bailout-reason.h"
10 #include "src/base/hashmap.h" 10 #include "src/base/hashmap.h"
(...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after
738 PreParserIdentifier arg, int pos) { 738 PreParserIdentifier arg, int pos) {
739 return PreParserExpression::Default(); 739 return PreParserExpression::Default();
740 } 740 }
741 741
742 PreParserExpression NewThrowTypeError(MessageTemplate::Template message, 742 PreParserExpression NewThrowTypeError(MessageTemplate::Template message,
743 PreParserIdentifier arg, int pos) { 743 PreParserIdentifier arg, int pos) {
744 return PreParserExpression::Default(); 744 return PreParserExpression::Default();
745 } 745 }
746 746
747 // Reporting errors. 747 // Reporting errors.
748 void ReportMessageAt(Scanner::Location location, 748 void ReportMessageAt(Scanner::Location source_location,
749 MessageTemplate::Template message, 749 MessageTemplate::Template message,
750 const char* arg = NULL, 750 const char* arg = NULL,
751 ParseErrorType error_type = kSyntaxError); 751 ParseErrorType error_type = kSyntaxError);
752 void ReportMessageAt(Scanner::Location location, 752 void ReportMessageAt(Scanner::Location source_location,
753 MessageTemplate::Template message, 753 MessageTemplate::Template message,
754 const AstRawString* arg, 754 const AstRawString* arg,
755 ParseErrorType error_type = kSyntaxError); 755 ParseErrorType error_type = kSyntaxError);
756 756
757 // A dummy function, just useful as an argument to CHECK_OK_CUSTOM. 757 // A dummy function, just useful as an argument to CHECK_OK_CUSTOM.
758 static void Void() {} 758 static void Void() {}
759 759
760 // "null" return type creators. 760 // "null" return type creators.
761 static PreParserIdentifier EmptyIdentifier() { 761 static PreParserIdentifier EmptyIdentifier() {
762 return PreParserIdentifier::Default(); 762 return PreParserIdentifier::Default();
763 } 763 }
764 static PreParserExpression EmptyExpression() { 764 static PreParserExpression EmptyExpression() {
765 return PreParserExpression::Default(); 765 return PreParserExpression::Default();
766 } 766 }
767 static PreParserExpression EmptyLiteral() { 767 static PreParserExpression EmptyLiteral() {
768 return PreParserExpression::Default(); 768 return PreParserExpression::Default();
769 } 769 }
770 static PreParserExpression EmptyObjectLiteralProperty() { 770 static PreParserExpression EmptyObjectLiteralProperty() {
771 return PreParserExpression::Default(); 771 return PreParserExpression::Default();
772 } 772 }
773 static PreParserExpression EmptyFunctionLiteral() { 773 static PreParserExpression EmptyFunctionLiteral() {
774 return PreParserExpression::Default(); 774 return PreParserExpression::Default();
775 } 775 }
776 776
777 static PreParserExpressionList NullExpressionList() { 777 static PreParserExpressionList NullExpressionList() {
778 return PreParserExpressionList(); 778 return PreParserExpressionList();
779 } 779 }
780 static PreParserIdentifier EmptyIdentifierString() { 780 PreParserIdentifier EmptyIdentifierString() const {
781 return PreParserIdentifier::Default(); 781 return PreParserIdentifier::Default();
782 } 782 }
783 783
784 // Odd-ball literal creators. 784 // Odd-ball literal creators.
785 PreParserExpression GetLiteralTheHole(int position, 785 PreParserExpression GetLiteralTheHole(int position,
786 PreParserFactory* factory) const { 786 PreParserFactory* factory) const {
787 return PreParserExpression::Default(); 787 return PreParserExpression::Default();
788 } 788 }
789 789
790 // Producing data during the recursive descent. 790 // Producing data during the recursive descent.
791 PreParserIdentifier GetSymbol(Scanner* scanner); 791 PreParserIdentifier GetSymbol(Scanner* scanner) const;
792 792
793 PreParserIdentifier GetNextSymbol(Scanner* scanner) const { 793 PreParserIdentifier GetNextSymbol(Scanner* scanner) const {
794 return PreParserIdentifier::Default(); 794 return PreParserIdentifier::Default();
795 } 795 }
796 796
797 PreParserIdentifier GetNumberAsSymbol(Scanner* scanner) { 797 PreParserIdentifier GetNumberAsSymbol(Scanner* scanner) const {
798 return PreParserIdentifier::Default(); 798 return PreParserIdentifier::Default();
799 } 799 }
800 800
801 PreParserExpression ThisExpression(int pos = kNoSourcePosition) const { 801 PreParserExpression ThisExpression(int pos = kNoSourcePosition) const {
802 return PreParserExpression::This(); 802 return PreParserExpression::This();
803 } 803 }
804 804
805 PreParserExpression NewSuperPropertyReference(PreParserFactory* factory, 805 PreParserExpression NewSuperPropertyReference(PreParserFactory* factory,
806 int pos) const { 806 int pos) const {
807 return PreParserExpression::Default(); 807 return PreParserExpression::Default();
(...skipping 19 matching lines...) Expand all
827 return PreParserExpression::Default(); 827 return PreParserExpression::Default();
828 } 828 }
829 829
830 PreParserExpression ExpressionFromIdentifier( 830 PreParserExpression ExpressionFromIdentifier(
831 PreParserIdentifier name, int start_position, int end_position, 831 PreParserIdentifier name, int start_position, int end_position,
832 InferName = InferName::kYes) const { 832 InferName = InferName::kYes) const {
833 return PreParserExpression::FromIdentifier(name); 833 return PreParserExpression::FromIdentifier(name);
834 } 834 }
835 835
836 PreParserExpression ExpressionFromString(int pos, Scanner* scanner, 836 PreParserExpression ExpressionFromString(int pos, Scanner* scanner,
837 PreParserFactory* factory); 837 PreParserFactory* factory) const;
838 838
839 PreParserExpression GetIterator(PreParserExpression iterable, 839 PreParserExpression GetIterator(PreParserExpression iterable,
840 PreParserFactory* factory, int pos) { 840 PreParserFactory* factory, int pos) {
841 return PreParserExpression::Default(); 841 return PreParserExpression::Default();
842 } 842 }
843 843
844 PreParserExpressionList NewExpressionList(int size, Zone* zone) const { 844 PreParserExpressionList NewExpressionList(int size, Zone* zone) const {
845 return PreParserExpressionList(); 845 return PreParserExpressionList();
846 } 846 }
847 847
848 PreParserExpressionList NewPropertyList(int size, Zone* zone) const { 848 PreParserExpressionList NewPropertyList(int size, Zone* zone) const {
849 return PreParserExpressionList(); 849 return PreParserExpressionList();
850 } 850 }
851 851
852 PreParserStatementList NewStatementList(int size, Zone* zone) const { 852 PreParserStatementList NewStatementList(int size, Zone* zone) const {
853 return PreParserStatementList(); 853 return PreParserStatementList();
854 } 854 }
855 855
856 void AddParameterInitializationBlock( 856 void AddParameterInitializationBlock(
857 const PreParserFormalParameters& parameters, PreParserStatementList list, 857 const PreParserFormalParameters& parameters, PreParserStatementList body,
858 bool is_async, bool* ok) const {} 858 bool is_async, bool* ok) const {}
859 859
860 void ParseAsyncArrowSingleExpressionBody( 860 void ParseAsyncArrowSingleExpressionBody(
861 PreParserStatementList body, bool accept_IN, 861 PreParserStatementList body, bool accept_IN,
862 Type::ExpressionClassifier* classifier, int pos, bool* ok); 862 Type::ExpressionClassifier* classifier, int pos, bool* ok);
863 863
864 864
865 void AddFormalParameter(PreParserFormalParameters* parameters, 865 void AddFormalParameter(PreParserFormalParameters* parameters,
866 PreParserExpression pattern, 866 PreParserExpression pattern,
867 PreParserExpression initializer, 867 PreParserExpression initializer,
868 int initializer_end_position, bool is_rest) { 868 int initializer_end_position, bool is_rest) {
869 ++parameters->arity; 869 ++parameters->arity;
870 } 870 }
871 871
872 void DeclareFormalParameter(DeclarationScope* scope, 872 void DeclareFormalParameter(DeclarationScope* scope,
873 PreParserIdentifier parameter, 873 PreParserIdentifier parameter,
874 Type::ExpressionClassifier* classifier) { 874 Type::ExpressionClassifier* classifier) {
875 if (!classifier->is_simple_parameter_list()) { 875 if (!classifier->is_simple_parameter_list()) {
876 scope->SetHasNonSimpleParameters(); 876 scope->SetHasNonSimpleParameters();
877 } 877 }
878 } 878 }
879 879
880 V8_INLINE void ParseArrowFunctionFormalParameterList( 880 V8_INLINE void ParseArrowFunctionFormalParameterList(
881 PreParserFormalParameters* parameters, PreParserExpression expression, 881 PreParserFormalParameters* parameters, PreParserExpression params,
882 const Scanner::Location& params_loc, Scanner::Location* duplicate_loc, 882 const Scanner::Location& params_loc, Scanner::Location* duplicate_loc,
883 const Scope::Snapshot& scope_snapshot, bool* ok); 883 const Scope::Snapshot& scope_snapshot, bool* ok);
884 884
885 V8_INLINE PreParserExpression ParseAsyncFunctionExpression(bool* ok); 885 V8_INLINE PreParserExpression ParseAsyncFunctionExpression(bool* ok);
886 886
887 V8_INLINE PreParserExpression ParseDoExpression(bool* ok); 887 V8_INLINE PreParserExpression ParseDoExpression(bool* ok);
888 888
889 void ReindexLiterals(const PreParserFormalParameters& parameters) {} 889 void ReindexLiterals(const PreParserFormalParameters& parameters) {}
890 890
891 // Temporary glue; these functions will move to ParserBase. 891 // Temporary glue; these functions will move to ParserBase.
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
1257 pre_parser_->function_state_->NextMaterializedLiteralIndex(); 1257 pre_parser_->function_state_->NextMaterializedLiteralIndex();
1258 pre_parser_->function_state_->NextMaterializedLiteralIndex(); 1258 pre_parser_->function_state_->NextMaterializedLiteralIndex();
1259 } 1259 }
1260 return EmptyExpression(); 1260 return EmptyExpression();
1261 } 1261 }
1262 1262
1263 } // namespace internal 1263 } // namespace internal
1264 } // namespace v8 1264 } // namespace v8
1265 1265
1266 #endif // V8_PARSING_PREPARSER_H 1266 #endif // V8_PARSING_PREPARSER_H
OLDNEW
« no previous file with comments | « src/parsing/parser-base.h ('k') | src/parsing/preparser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698