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 844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
855 } | 855 } |
856 | 856 |
857 PreParserStatementList NewStatementList(int size, Zone* zone) const { | 857 PreParserStatementList NewStatementList(int size, Zone* zone) const { |
858 return PreParserStatementList(); | 858 return PreParserStatementList(); |
859 } | 859 } |
860 | 860 |
861 void AddParameterInitializationBlock( | 861 void AddParameterInitializationBlock( |
862 const PreParserFormalParameters& parameters, PreParserStatementList body, | 862 const PreParserFormalParameters& parameters, PreParserStatementList body, |
863 bool is_async, bool* ok) {} | 863 bool is_async, bool* ok) {} |
864 | 864 |
865 void ParseAsyncArrowSingleExpressionBody( | |
866 PreParserStatementList body, bool accept_IN, | |
867 Type::ExpressionClassifier* classifier, int pos, bool* ok); | |
868 | |
869 | |
870 void AddFormalParameter(PreParserFormalParameters* parameters, | 865 void AddFormalParameter(PreParserFormalParameters* parameters, |
871 PreParserExpression pattern, | 866 PreParserExpression pattern, |
872 PreParserExpression initializer, | 867 PreParserExpression initializer, |
873 int initializer_end_position, bool is_rest) { | 868 int initializer_end_position, bool is_rest) { |
874 ++parameters->arity; | 869 ++parameters->arity; |
875 } | 870 } |
876 | 871 |
877 void DeclareFormalParameter(DeclarationScope* scope, | 872 void DeclareFormalParameter(DeclarationScope* scope, |
878 PreParserIdentifier parameter, | 873 PreParserIdentifier parameter, |
879 Type::ExpressionClassifier* classifier) { | 874 Type::ExpressionClassifier* classifier) { |
880 if (!classifier->is_simple_parameter_list()) { | 875 if (!classifier->is_simple_parameter_list()) { |
881 scope->SetHasNonSimpleParameters(); | 876 scope->SetHasNonSimpleParameters(); |
882 } | 877 } |
883 } | 878 } |
884 | 879 |
885 V8_INLINE void ParseArrowFunctionFormalParameterList( | 880 V8_INLINE void ParseArrowFunctionFormalParameterList( |
886 PreParserFormalParameters* parameters, PreParserExpression params, | 881 PreParserFormalParameters* parameters, PreParserExpression params, |
887 const Scanner::Location& params_loc, Scanner::Location* duplicate_loc, | 882 const Scanner::Location& params_loc, Scanner::Location* duplicate_loc, |
888 const Scope::Snapshot& scope_snapshot, bool* ok); | 883 const Scope::Snapshot& scope_snapshot, bool* ok); |
889 | 884 |
890 V8_INLINE PreParserExpression ParseAsyncFunctionExpression(bool* ok); | |
891 | |
892 V8_INLINE PreParserExpression ParseDoExpression(bool* ok); | |
893 | |
894 void ReindexLiterals(const PreParserFormalParameters& parameters) {} | 885 void ReindexLiterals(const PreParserFormalParameters& parameters) {} |
895 | 886 |
896 // Temporary glue; these functions will move to ParserBase. | |
897 PreParserExpression ParseV8Intrinsic(bool* ok); | |
898 PreParserExpression ParseFunctionLiteral( | |
899 PreParserIdentifier name, Scanner::Location function_name_location, | |
900 FunctionNameValidity function_name_validity, FunctionKind kind, | |
901 int function_token_position, FunctionLiteral::FunctionType type, | |
902 LanguageMode language_mode, bool* ok); | |
903 | |
904 V8_INLINE void SkipLazyFunctionBody( | |
905 int* materialized_literal_count, int* expected_property_count, bool* ok, | |
906 Scanner::BookmarkScope* bookmark = nullptr) { | |
907 UNREACHABLE(); | |
908 } | |
909 | |
910 V8_INLINE PreParserStatementList ParseEagerFunctionBody( | |
911 PreParserIdentifier name, int pos, | |
912 const PreParserFormalParameters& parameters, FunctionKind kind, | |
913 FunctionLiteral::FunctionType function_type, bool* ok); | |
914 | |
915 PreParserExpression ParseClassLiteral(Type::ExpressionClassifier* classifier, | |
916 PreParserIdentifier name, | |
917 Scanner::Location class_name_location, | |
918 bool name_is_strict_reserved, int pos, | |
919 bool* ok); | |
920 | |
921 V8_INLINE void MarkCollectedTailCallExpressions() {} | |
922 V8_INLINE void MarkTailPosition(PreParserExpression expression) {} | |
923 | |
924 void CheckConflictingVarDeclarations(Scope* scope, bool* ok) {} | |
925 | |
926 struct TemplateLiteralState {}; | |
927 | |
928 V8_INLINE TemplateLiteralState OpenTemplateLiteral(int pos) { | |
929 return TemplateLiteralState(); | |
930 } | |
931 V8_INLINE void AddTemplateSpan(TemplateLiteralState* state, bool tail) {} | |
932 V8_INLINE void AddTemplateExpression(TemplateLiteralState* state, | |
933 PreParserExpression expression) {} | |
934 V8_INLINE PreParserExpression CloseTemplateLiteral( | |
935 TemplateLiteralState* state, int start, PreParserExpression tag); | |
936 V8_INLINE PreParserExpression NoTemplateTag() { | 887 V8_INLINE PreParserExpression NoTemplateTag() { |
937 return PreParserExpression::NoTemplateTag(); | 888 return PreParserExpression::NoTemplateTag(); |
938 } | 889 } |
939 V8_INLINE static bool IsTaggedTemplate(const PreParserExpression tag) { | 890 V8_INLINE static bool IsTaggedTemplate(const PreParserExpression tag) { |
940 return !tag.IsNoTemplateTag(); | 891 return !tag.IsNoTemplateTag(); |
941 } | 892 } |
942 | 893 |
943 V8_INLINE PreParserExpressionList | |
944 PrepareSpreadArguments(PreParserExpressionList list) { | |
945 return list; | |
946 } | |
947 | |
948 inline void MaterializeUnspreadArgumentsLiterals(int count); | 894 inline void MaterializeUnspreadArgumentsLiterals(int count); |
949 | 895 |
950 inline PreParserExpression SpreadCall(PreParserExpression function, | |
951 PreParserExpressionList args, int pos); | |
952 | |
953 inline PreParserExpression SpreadCallNew(PreParserExpression function, | |
954 PreParserExpressionList args, | |
955 int pos); | |
956 | |
957 inline PreParserExpression ExpressionListToExpression( | 896 inline PreParserExpression ExpressionListToExpression( |
958 PreParserExpressionList args) { | 897 PreParserExpressionList args) { |
959 return PreParserExpression::Default(); | 898 return PreParserExpression::Default(); |
960 } | 899 } |
961 | 900 |
962 inline void RewriteDestructuringAssignments() {} | |
963 | |
964 inline PreParserExpression RewriteExponentiation(PreParserExpression left, | |
965 PreParserExpression right, | |
966 int pos) { | |
967 return left; | |
968 } | |
969 inline PreParserExpression RewriteAssignExponentiation( | |
970 PreParserExpression left, PreParserExpression right, int pos) { | |
971 return left; | |
972 } | |
973 inline PreParserExpression RewriteAwaitExpression(PreParserExpression value, | |
974 int pos); | |
975 | |
976 inline void QueueDestructuringAssignmentForRewriting( | |
977 PreParserExpression assignment) {} | |
978 inline void QueueNonPatternForRewriting(PreParserExpression expr, bool* ok) {} | |
979 | |
980 void SetFunctionNameFromPropertyName(PreParserExpression property, | 901 void SetFunctionNameFromPropertyName(PreParserExpression property, |
981 PreParserIdentifier name) {} | 902 PreParserIdentifier name) {} |
982 void SetFunctionNameFromIdentifierRef(PreParserExpression value, | 903 void SetFunctionNameFromIdentifierRef(PreParserExpression value, |
983 PreParserExpression identifier) {} | 904 PreParserExpression identifier) {} |
984 | 905 |
985 inline void RewriteNonPattern(Type::ExpressionClassifier* classifier, | |
986 bool* ok); | |
987 | |
988 V8_INLINE ZoneList<typename Type::ExpressionClassifier::Error>* | 906 V8_INLINE ZoneList<typename Type::ExpressionClassifier::Error>* |
989 GetReportedErrorList() const; | 907 GetReportedErrorList() const; |
990 V8_INLINE Zone* zone() const; | 908 V8_INLINE Zone* zone() const; |
991 V8_INLINE ZoneList<PreParserExpression>* GetNonPatternList() const; | 909 V8_INLINE ZoneList<PreParserExpression>* GetNonPatternList() const; |
992 | |
993 inline PreParserExpression RewriteYieldStar(PreParserExpression generator, | |
994 PreParserExpression expression, | |
995 int pos); | |
996 }; | 910 }; |
997 | 911 |
998 | 912 |
999 // Preparsing checks a JavaScript program and emits preparse-data that helps | 913 // Preparsing checks a JavaScript program and emits preparse-data that helps |
1000 // a later parsing to be faster. | 914 // a later parsing to be faster. |
1001 // See preparse-data-format.h for the data format. | 915 // See preparse-data-format.h for the data format. |
1002 | 916 |
1003 // The PreParser checks that the syntax follows the grammar for JavaScript, | 917 // The PreParser checks that the syntax follows the grammar for JavaScript, |
1004 // and collects some information about the program along the way. | 918 // and collects some information about the program along the way. |
1005 // The grammar check is only performed in order to understand the program | 919 // The grammar check is only performed in order to understand the program |
1006 // sufficiently to deduce some information about it, that can be used | 920 // sufficiently to deduce some information about it, that can be used |
1007 // to speed up later parsing. Finding errors is not the goal of pre-parsing, | 921 // to speed up later parsing. Finding errors is not the goal of pre-parsing, |
1008 // rather it is to speed up properly written and correct programs. | 922 // rather it is to speed up properly written and correct programs. |
1009 // That means that contextual checks (like a label being declared where | 923 // That means that contextual checks (like a label being declared where |
1010 // it is used) are generally omitted. | 924 // it is used) are generally omitted. |
1011 class PreParser : public ParserBase<PreParser> { | 925 class PreParser : public ParserBase<PreParser> { |
| 926 friend class ParserBase<PreParser>; |
1012 // TODO(nikolaos): This should not be necessary. It will be removed | 927 // TODO(nikolaos): This should not be necessary. It will be removed |
1013 // when the traits object stops delegating to the implementation object. | 928 // when the traits object stops delegating to the implementation object. |
1014 friend class ParserBaseTraits<PreParser>; | 929 friend class ParserBaseTraits<PreParser>; |
1015 | 930 |
1016 public: | 931 public: |
1017 typedef PreParserIdentifier Identifier; | 932 typedef PreParserIdentifier Identifier; |
1018 typedef PreParserExpression Expression; | 933 typedef PreParserExpression Expression; |
1019 typedef PreParserStatement Statement; | 934 typedef PreParserStatement Statement; |
1020 | 935 |
1021 enum PreParseResult { | 936 enum PreParseResult { |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1132 Expression ParseConditionalExpression(bool accept_IN, bool* ok); | 1047 Expression ParseConditionalExpression(bool accept_IN, bool* ok); |
1133 Expression ParseObjectLiteral(bool* ok); | 1048 Expression ParseObjectLiteral(bool* ok); |
1134 Expression ParseV8Intrinsic(bool* ok); | 1049 Expression ParseV8Intrinsic(bool* ok); |
1135 Expression ParseDoExpression(bool* ok); | 1050 Expression ParseDoExpression(bool* ok); |
1136 | 1051 |
1137 V8_INLINE PreParserStatementList ParseEagerFunctionBody( | 1052 V8_INLINE PreParserStatementList ParseEagerFunctionBody( |
1138 PreParserIdentifier function_name, int pos, | 1053 PreParserIdentifier function_name, int pos, |
1139 const PreParserFormalParameters& parameters, FunctionKind kind, | 1054 const PreParserFormalParameters& parameters, FunctionKind kind, |
1140 FunctionLiteral::FunctionType function_type, bool* ok); | 1055 FunctionLiteral::FunctionType function_type, bool* ok); |
1141 | 1056 |
| 1057 V8_INLINE void SkipLazyFunctionBody( |
| 1058 int* materialized_literal_count, int* expected_property_count, bool* ok, |
| 1059 Scanner::BookmarkScope* bookmark = nullptr) { |
| 1060 UNREACHABLE(); |
| 1061 } |
1142 Expression ParseFunctionLiteral( | 1062 Expression ParseFunctionLiteral( |
1143 Identifier name, Scanner::Location function_name_location, | 1063 Identifier name, Scanner::Location function_name_location, |
1144 FunctionNameValidity function_name_validity, FunctionKind kind, | 1064 FunctionNameValidity function_name_validity, FunctionKind kind, |
1145 int function_token_pos, FunctionLiteral::FunctionType function_type, | 1065 int function_token_pos, FunctionLiteral::FunctionType function_type, |
1146 LanguageMode language_mode, bool* ok); | 1066 LanguageMode language_mode, bool* ok); |
1147 void ParseLazyFunctionLiteralBody(bool* ok, | 1067 void ParseLazyFunctionLiteralBody(bool* ok, |
1148 Scanner::BookmarkScope* bookmark = nullptr); | 1068 Scanner::BookmarkScope* bookmark = nullptr); |
1149 | 1069 |
1150 PreParserExpression ParseClassLiteral(ExpressionClassifier* classifier, | 1070 PreParserExpression ParseClassLiteral(ExpressionClassifier* classifier, |
1151 PreParserIdentifier name, | 1071 PreParserIdentifier name, |
1152 Scanner::Location class_name_location, | 1072 Scanner::Location class_name_location, |
1153 bool name_is_strict_reserved, int pos, | 1073 bool name_is_strict_reserved, int pos, |
1154 bool* ok); | 1074 bool* ok); |
1155 | 1075 |
| 1076 struct TemplateLiteralState {}; |
| 1077 |
| 1078 V8_INLINE TemplateLiteralState OpenTemplateLiteral(int pos) { |
| 1079 return TemplateLiteralState(); |
| 1080 } |
| 1081 V8_INLINE void AddTemplateExpression(TemplateLiteralState* state, |
| 1082 PreParserExpression expression) {} |
| 1083 V8_INLINE void AddTemplateSpan(TemplateLiteralState* state, bool tail) {} |
| 1084 V8_INLINE PreParserExpression CloseTemplateLiteral( |
| 1085 TemplateLiteralState* state, int start, PreParserExpression tag); |
| 1086 V8_INLINE void CheckConflictingVarDeclarations(Scope* scope, bool* ok) {} |
| 1087 |
| 1088 V8_INLINE void MarkCollectedTailCallExpressions() {} |
| 1089 V8_INLINE void MarkTailPosition(PreParserExpression expression) {} |
| 1090 |
| 1091 void ParseAsyncArrowSingleExpressionBody(PreParserStatementList body, |
| 1092 bool accept_IN, |
| 1093 ExpressionClassifier* classifier, |
| 1094 int pos, bool* ok); |
| 1095 |
| 1096 V8_INLINE PreParserExpressionList |
| 1097 PrepareSpreadArguments(PreParserExpressionList list) { |
| 1098 return list; |
| 1099 } |
| 1100 |
| 1101 V8_INLINE PreParserExpression SpreadCall(PreParserExpression function, |
| 1102 PreParserExpressionList args, |
| 1103 int pos); |
| 1104 V8_INLINE PreParserExpression SpreadCallNew(PreParserExpression function, |
| 1105 PreParserExpressionList args, |
| 1106 int pos); |
| 1107 |
| 1108 V8_INLINE void RewriteDestructuringAssignments() {} |
| 1109 |
| 1110 V8_INLINE PreParserExpression RewriteExponentiation(PreParserExpression left, |
| 1111 PreParserExpression right, |
| 1112 int pos) { |
| 1113 return left; |
| 1114 } |
| 1115 V8_INLINE PreParserExpression RewriteAssignExponentiation( |
| 1116 PreParserExpression left, PreParserExpression right, int pos) { |
| 1117 return left; |
| 1118 } |
| 1119 |
| 1120 V8_INLINE PreParserExpression |
| 1121 RewriteAwaitExpression(PreParserExpression value, int pos) { |
| 1122 return value; |
| 1123 } |
| 1124 V8_INLINE PreParserExpression RewriteYieldStar(PreParserExpression generator, |
| 1125 PreParserExpression expression, |
| 1126 int pos) { |
| 1127 return PreParserExpression::Default(); |
| 1128 } |
| 1129 V8_INLINE void RewriteNonPattern(Type::ExpressionClassifier* classifier, |
| 1130 bool* ok) { |
| 1131 ValidateExpression(classifier, ok); |
| 1132 } |
| 1133 |
| 1134 V8_INLINE void QueueDestructuringAssignmentForRewriting( |
| 1135 PreParserExpression assignment) {} |
| 1136 V8_INLINE void QueueNonPatternForRewriting(PreParserExpression expr, |
| 1137 bool* ok) {} |
| 1138 |
1156 int* use_counts_; | 1139 int* use_counts_; |
1157 }; | 1140 }; |
1158 | 1141 |
1159 void ParserBaseTraits<PreParser>::MaterializeUnspreadArgumentsLiterals( | 1142 void ParserBaseTraits<PreParser>::MaterializeUnspreadArgumentsLiterals( |
1160 int count) { | 1143 int count) { |
1161 for (int i = 0; i < count; ++i) { | 1144 for (int i = 0; i < count; ++i) { |
1162 delegate()->function_state_->NextMaterializedLiteralIndex(); | 1145 delegate()->function_state_->NextMaterializedLiteralIndex(); |
1163 } | 1146 } |
1164 } | 1147 } |
1165 | 1148 |
1166 PreParserExpression ParserBaseTraits<PreParser>::SpreadCall( | 1149 PreParserExpression PreParser::SpreadCall(PreParserExpression function, |
1167 PreParserExpression function, PreParserExpressionList args, int pos) { | 1150 PreParserExpressionList args, |
1168 return delegate()->factory()->NewCall(function, args, pos); | 1151 int pos) { |
| 1152 return factory()->NewCall(function, args, pos); |
1169 } | 1153 } |
1170 | 1154 |
1171 PreParserExpression ParserBaseTraits<PreParser>::SpreadCallNew( | 1155 PreParserExpression PreParser::SpreadCallNew(PreParserExpression function, |
1172 PreParserExpression function, PreParserExpressionList args, int pos) { | 1156 PreParserExpressionList args, |
1173 return delegate()->factory()->NewCallNew(function, args, pos); | 1157 int pos) { |
| 1158 return factory()->NewCallNew(function, args, pos); |
1174 } | 1159 } |
1175 | 1160 |
1176 void ParserBaseTraits<PreParser>::ParseArrowFunctionFormalParameterList( | 1161 void ParserBaseTraits<PreParser>::ParseArrowFunctionFormalParameterList( |
1177 PreParserFormalParameters* parameters, PreParserExpression params, | 1162 PreParserFormalParameters* parameters, PreParserExpression params, |
1178 const Scanner::Location& params_loc, Scanner::Location* duplicate_loc, | 1163 const Scanner::Location& params_loc, Scanner::Location* duplicate_loc, |
1179 const Scope::Snapshot& scope_snapshot, bool* ok) { | 1164 const Scope::Snapshot& scope_snapshot, bool* ok) { |
1180 // TODO(wingo): Detect duplicated identifiers in paramlists. Detect parameter | 1165 // TODO(wingo): Detect duplicated identifiers in paramlists. Detect parameter |
1181 // lists that are too long. | 1166 // lists that are too long. |
1182 } | 1167 } |
1183 | 1168 |
1184 PreParserExpression ParserBaseTraits<PreParser>::ParseAsyncFunctionExpression( | |
1185 bool* ok) { | |
1186 return delegate()->ParseAsyncFunctionExpression(ok); | |
1187 } | |
1188 | |
1189 PreParserExpression ParserBaseTraits<PreParser>::ParseDoExpression(bool* ok) { | |
1190 return delegate()->ParseDoExpression(ok); | |
1191 } | |
1192 | |
1193 void ParserBaseTraits<PreParser>::RewriteNonPattern( | |
1194 Type::ExpressionClassifier* classifier, bool* ok) { | |
1195 delegate()->ValidateExpression(classifier, ok); | |
1196 } | |
1197 | |
1198 PreParserExpression ParserBaseTraits<PreParser>::RewriteAwaitExpression( | |
1199 PreParserExpression value, int pos) { | |
1200 return value; | |
1201 } | |
1202 | |
1203 ZoneList<PreParserExpression>* ParserBaseTraits<PreParser>::GetNonPatternList() | 1169 ZoneList<PreParserExpression>* ParserBaseTraits<PreParser>::GetNonPatternList() |
1204 const { | 1170 const { |
1205 return delegate()->function_state_->non_patterns_to_rewrite(); | 1171 return delegate()->function_state_->non_patterns_to_rewrite(); |
1206 } | 1172 } |
1207 | 1173 |
1208 ZoneList< | 1174 ZoneList< |
1209 typename ParserBaseTraits<PreParser>::Type::ExpressionClassifier::Error>* | 1175 typename ParserBaseTraits<PreParser>::Type::ExpressionClassifier::Error>* |
1210 ParserBaseTraits<PreParser>::GetReportedErrorList() const { | 1176 ParserBaseTraits<PreParser>::GetReportedErrorList() const { |
1211 return delegate()->function_state_->GetReportedErrorList(); | 1177 return delegate()->function_state_->GetReportedErrorList(); |
1212 } | 1178 } |
1213 | 1179 |
1214 Zone* ParserBaseTraits<PreParser>::zone() const { | 1180 Zone* ParserBaseTraits<PreParser>::zone() const { |
1215 return delegate()->function_state_->scope()->zone(); | 1181 return delegate()->function_state_->scope()->zone(); |
1216 } | 1182 } |
1217 | 1183 |
1218 PreParserExpression ParserBaseTraits<PreParser>::RewriteYieldStar( | |
1219 PreParserExpression generator, PreParserExpression expression, int pos) { | |
1220 return PreParserExpression::Default(); | |
1221 } | |
1222 | |
1223 PreParserStatementList PreParser::ParseEagerFunctionBody( | 1184 PreParserStatementList PreParser::ParseEagerFunctionBody( |
1224 PreParserIdentifier function_name, int pos, | 1185 PreParserIdentifier function_name, int pos, |
1225 const PreParserFormalParameters& parameters, FunctionKind kind, | 1186 const PreParserFormalParameters& parameters, FunctionKind kind, |
1226 FunctionLiteral::FunctionType function_type, bool* ok) { | 1187 FunctionLiteral::FunctionType function_type, bool* ok) { |
1227 ParsingModeScope parsing_mode(this, PARSE_EAGERLY); | 1188 ParsingModeScope parsing_mode(this, PARSE_EAGERLY); |
1228 | 1189 |
1229 Scope* inner_scope = scope(); | 1190 Scope* inner_scope = scope(); |
1230 if (!parameters.is_simple) inner_scope = NewScope(BLOCK_SCOPE); | 1191 if (!parameters.is_simple) inner_scope = NewScope(BLOCK_SCOPE); |
1231 | 1192 |
1232 { | 1193 { |
1233 BlockState block_state(&scope_state_, inner_scope); | 1194 BlockState block_state(&scope_state_, inner_scope); |
1234 ParseStatementList(Token::RBRACE, ok); | 1195 ParseStatementList(Token::RBRACE, ok); |
1235 if (!*ok) return PreParserStatementList(); | 1196 if (!*ok) return PreParserStatementList(); |
1236 } | 1197 } |
1237 | 1198 |
1238 Expect(Token::RBRACE, ok); | 1199 Expect(Token::RBRACE, ok); |
1239 return PreParserStatementList(); | 1200 return PreParserStatementList(); |
1240 } | 1201 } |
1241 | 1202 |
1242 PreParserStatementList ParserBaseTraits<PreParser>::ParseEagerFunctionBody( | 1203 PreParserExpression PreParser::CloseTemplateLiteral(TemplateLiteralState* state, |
1243 PreParserIdentifier function_name, int pos, | 1204 int start, |
1244 const PreParserFormalParameters& parameters, FunctionKind kind, | 1205 PreParserExpression tag) { |
1245 FunctionLiteral::FunctionType function_type, bool* ok) { | |
1246 return delegate()->ParseEagerFunctionBody(function_name, pos, parameters, | |
1247 kind, function_type, ok); | |
1248 } | |
1249 | |
1250 PreParserExpression ParserBaseTraits<PreParser>::CloseTemplateLiteral( | |
1251 TemplateLiteralState* state, int start, PreParserExpression tag) { | |
1252 if (IsTaggedTemplate(tag)) { | 1206 if (IsTaggedTemplate(tag)) { |
1253 // Emulate generation of array literals for tag callsite | 1207 // Emulate generation of array literals for tag callsite |
1254 // 1st is array of cooked strings, second is array of raw strings | 1208 // 1st is array of cooked strings, second is array of raw strings |
1255 delegate()->function_state_->NextMaterializedLiteralIndex(); | 1209 function_state_->NextMaterializedLiteralIndex(); |
1256 delegate()->function_state_->NextMaterializedLiteralIndex(); | 1210 function_state_->NextMaterializedLiteralIndex(); |
1257 } | 1211 } |
1258 return EmptyExpression(); | 1212 return EmptyExpression(); |
1259 } | 1213 } |
1260 | 1214 |
1261 } // namespace internal | 1215 } // namespace internal |
1262 } // namespace v8 | 1216 } // namespace v8 |
1263 | 1217 |
1264 #endif // V8_PARSING_PREPARSER_H | 1218 #endif // V8_PARSING_PREPARSER_H |
OLD | NEW |