OLD | NEW |
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 764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
775 UNREACHABLE(); | 775 UNREACHABLE(); |
776 } | 776 } |
777 Expression ParseFunctionLiteral( | 777 Expression ParseFunctionLiteral( |
778 Identifier name, Scanner::Location function_name_location, | 778 Identifier name, Scanner::Location function_name_location, |
779 FunctionNameValidity function_name_validity, FunctionKind kind, | 779 FunctionNameValidity function_name_validity, FunctionKind kind, |
780 int function_token_pos, FunctionLiteral::FunctionType function_type, | 780 int function_token_pos, FunctionLiteral::FunctionType function_type, |
781 LanguageMode language_mode, bool* ok); | 781 LanguageMode language_mode, bool* ok); |
782 void ParseLazyFunctionLiteralBody(bool* ok, | 782 void ParseLazyFunctionLiteralBody(bool* ok, |
783 Scanner::BookmarkScope* bookmark = nullptr); | 783 Scanner::BookmarkScope* bookmark = nullptr); |
784 | 784 |
785 PreParserExpression ParseClassLiteral(ExpressionClassifier* classifier, | 785 PreParserExpression ParseClassLiteral(PreParserIdentifier name, |
786 PreParserIdentifier name, | |
787 Scanner::Location class_name_location, | 786 Scanner::Location class_name_location, |
788 bool name_is_strict_reserved, int pos, | 787 bool name_is_strict_reserved, int pos, |
789 bool* ok); | 788 bool* ok); |
790 | 789 |
791 struct TemplateLiteralState {}; | 790 struct TemplateLiteralState {}; |
792 | 791 |
793 V8_INLINE TemplateLiteralState OpenTemplateLiteral(int pos) { | 792 V8_INLINE TemplateLiteralState OpenTemplateLiteral(int pos) { |
794 return TemplateLiteralState(); | 793 return TemplateLiteralState(); |
795 } | 794 } |
796 V8_INLINE void AddTemplateExpression(TemplateLiteralState* state, | 795 V8_INLINE void AddTemplateExpression(TemplateLiteralState* state, |
797 PreParserExpression expression) {} | 796 PreParserExpression expression) {} |
798 V8_INLINE void AddTemplateSpan(TemplateLiteralState* state, bool tail) {} | 797 V8_INLINE void AddTemplateSpan(TemplateLiteralState* state, bool tail) {} |
799 V8_INLINE PreParserExpression CloseTemplateLiteral( | 798 V8_INLINE PreParserExpression CloseTemplateLiteral( |
800 TemplateLiteralState* state, int start, PreParserExpression tag); | 799 TemplateLiteralState* state, int start, PreParserExpression tag); |
801 V8_INLINE void CheckConflictingVarDeclarations(Scope* scope, bool* ok) {} | 800 V8_INLINE void CheckConflictingVarDeclarations(Scope* scope, bool* ok) {} |
802 | 801 |
803 V8_INLINE void MarkCollectedTailCallExpressions() {} | 802 V8_INLINE void MarkCollectedTailCallExpressions() {} |
804 V8_INLINE void MarkTailPosition(PreParserExpression expression) {} | 803 V8_INLINE void MarkTailPosition(PreParserExpression expression) {} |
805 | 804 |
806 void ParseAsyncArrowSingleExpressionBody(PreParserStatementList body, | 805 void ParseAsyncArrowSingleExpressionBody(PreParserStatementList body, |
807 bool accept_IN, | 806 bool accept_IN, |
808 ExpressionClassifier* classifier, | |
809 int pos, bool* ok); | 807 int pos, bool* ok); |
810 | 808 |
811 V8_INLINE PreParserExpressionList | 809 V8_INLINE PreParserExpressionList |
812 PrepareSpreadArguments(PreParserExpressionList list) { | 810 PrepareSpreadArguments(PreParserExpressionList list) { |
813 return list; | 811 return list; |
814 } | 812 } |
815 | 813 |
816 V8_INLINE PreParserExpression SpreadCall(PreParserExpression function, | 814 V8_INLINE PreParserExpression SpreadCall(PreParserExpression function, |
817 PreParserExpressionList args, | 815 PreParserExpressionList args, |
818 int pos); | 816 int pos); |
(...skipping 15 matching lines...) Expand all Loading... |
834 | 832 |
835 V8_INLINE PreParserExpression | 833 V8_INLINE PreParserExpression |
836 RewriteAwaitExpression(PreParserExpression value, int pos) { | 834 RewriteAwaitExpression(PreParserExpression value, int pos) { |
837 return value; | 835 return value; |
838 } | 836 } |
839 V8_INLINE PreParserExpression RewriteYieldStar(PreParserExpression generator, | 837 V8_INLINE PreParserExpression RewriteYieldStar(PreParserExpression generator, |
840 PreParserExpression expression, | 838 PreParserExpression expression, |
841 int pos) { | 839 int pos) { |
842 return PreParserExpression::Default(); | 840 return PreParserExpression::Default(); |
843 } | 841 } |
844 V8_INLINE void RewriteNonPattern(ExpressionClassifier* classifier, bool* ok) { | 842 V8_INLINE void RewriteNonPattern(bool* ok) { ValidateExpression(ok); } |
845 ValidateExpression(classifier, ok); | |
846 } | |
847 | 843 |
848 V8_INLINE void QueueDestructuringAssignmentForRewriting( | 844 V8_INLINE void QueueDestructuringAssignmentForRewriting( |
849 PreParserExpression assignment) {} | 845 PreParserExpression assignment) {} |
850 V8_INLINE void QueueNonPatternForRewriting(PreParserExpression expr, | 846 V8_INLINE void QueueNonPatternForRewriting(PreParserExpression expr, |
851 bool* ok) {} | 847 bool* ok) {} |
852 | 848 |
853 // Helper functions for recursive descent. | 849 // Helper functions for recursive descent. |
854 V8_INLINE bool IsEval(PreParserIdentifier identifier) const { | 850 V8_INLINE bool IsEval(PreParserIdentifier identifier) const { |
855 return identifier.IsEval(); | 851 return identifier.IsEval(); |
856 } | 852 } |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1090 | 1086 |
1091 V8_INLINE void AddFormalParameter(PreParserFormalParameters* parameters, | 1087 V8_INLINE void AddFormalParameter(PreParserFormalParameters* parameters, |
1092 PreParserExpression pattern, | 1088 PreParserExpression pattern, |
1093 PreParserExpression initializer, | 1089 PreParserExpression initializer, |
1094 int initializer_end_position, | 1090 int initializer_end_position, |
1095 bool is_rest) { | 1091 bool is_rest) { |
1096 ++parameters->arity; | 1092 ++parameters->arity; |
1097 } | 1093 } |
1098 | 1094 |
1099 V8_INLINE void DeclareFormalParameter(DeclarationScope* scope, | 1095 V8_INLINE void DeclareFormalParameter(DeclarationScope* scope, |
1100 PreParserIdentifier parameter, | 1096 PreParserIdentifier parameter) { |
1101 ExpressionClassifier* classifier) { | 1097 if (!classifier()->is_simple_parameter_list()) { |
1102 if (!classifier->is_simple_parameter_list()) { | |
1103 scope->SetHasNonSimpleParameters(); | 1098 scope->SetHasNonSimpleParameters(); |
1104 } | 1099 } |
1105 } | 1100 } |
1106 | 1101 |
1107 V8_INLINE void ParseArrowFunctionFormalParameterList( | 1102 V8_INLINE void ParseArrowFunctionFormalParameterList( |
1108 PreParserFormalParameters* parameters, PreParserExpression params, | 1103 PreParserFormalParameters* parameters, PreParserExpression params, |
1109 const Scanner::Location& params_loc, Scanner::Location* duplicate_loc, | 1104 const Scanner::Location& params_loc, Scanner::Location* duplicate_loc, |
1110 const Scope::Snapshot& scope_snapshot, bool* ok) { | 1105 const Scope::Snapshot& scope_snapshot, bool* ok) { |
1111 // TODO(wingo): Detect duplicated identifiers in paramlists. Detect | 1106 // TODO(wingo): Detect duplicated identifiers in paramlists. Detect |
1112 // parameter | 1107 // parameter |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1193 function_state_->NextMaterializedLiteralIndex(); | 1188 function_state_->NextMaterializedLiteralIndex(); |
1194 function_state_->NextMaterializedLiteralIndex(); | 1189 function_state_->NextMaterializedLiteralIndex(); |
1195 } | 1190 } |
1196 return EmptyExpression(); | 1191 return EmptyExpression(); |
1197 } | 1192 } |
1198 | 1193 |
1199 } // namespace internal | 1194 } // namespace internal |
1200 } // namespace v8 | 1195 } // namespace v8 |
1201 | 1196 |
1202 #endif // V8_PARSING_PREPARSER_H | 1197 #endif // V8_PARSING_PREPARSER_H |
OLD | NEW |