| 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_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/allocation.h" | 8 #include "src/allocation.h" |
| 9 #include "src/ast/ast.h" | 9 #include "src/ast/ast.h" |
| 10 #include "src/ast/scopes.h" | 10 #include "src/ast/scopes.h" |
| (...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 | 353 |
| 354 explicit ParserFormalParameters(DeclarationScope* scope) | 354 explicit ParserFormalParameters(DeclarationScope* scope) |
| 355 : FormalParametersBase(scope), params(4, scope->zone()) {} | 355 : FormalParametersBase(scope), params(4, scope->zone()) {} |
| 356 ZoneList<Parameter> params; | 356 ZoneList<Parameter> params; |
| 357 | 357 |
| 358 int Arity() const { return params.length(); } | 358 int Arity() const { return params.length(); } |
| 359 const Parameter& at(int i) const { return params[i]; } | 359 const Parameter& at(int i) const { return params[i]; } |
| 360 }; | 360 }; |
| 361 | 361 |
| 362 | 362 |
| 363 class ParserTraits { | 363 template <> |
| 364 class ParserBaseTraits<Parser> { |
| 364 public: | 365 public: |
| 366 typedef ParserBaseTraits<Parser> ParserTraits; |
| 367 |
| 365 struct Type { | 368 struct Type { |
| 366 // TODO(marja): To be removed. The Traits object should contain all the data | |
| 367 // it needs. | |
| 368 typedef v8::internal::Parser* Parser; | |
| 369 | |
| 370 typedef Variable GeneratorVariable; | 369 typedef Variable GeneratorVariable; |
| 371 | 370 |
| 372 typedef v8::internal::AstProperties AstProperties; | 371 typedef v8::internal::AstProperties AstProperties; |
| 373 | 372 |
| 374 typedef v8::internal::ExpressionClassifier<ParserTraits> | 373 typedef v8::internal::ExpressionClassifier<ParserTraits> |
| 375 ExpressionClassifier; | 374 ExpressionClassifier; |
| 376 | 375 |
| 377 // Return types for traversing functions. | 376 // Return types for traversing functions. |
| 378 typedef const AstRawString* Identifier; | 377 typedef const AstRawString* Identifier; |
| 379 typedef v8::internal::Expression* Expression; | 378 typedef v8::internal::Expression* Expression; |
| 380 typedef Yield* YieldExpression; | 379 typedef Yield* YieldExpression; |
| 381 typedef v8::internal::FunctionLiteral* FunctionLiteral; | 380 typedef v8::internal::FunctionLiteral* FunctionLiteral; |
| 382 typedef v8::internal::ClassLiteral* ClassLiteral; | 381 typedef v8::internal::ClassLiteral* ClassLiteral; |
| 383 typedef v8::internal::Literal* Literal; | 382 typedef v8::internal::Literal* Literal; |
| 384 typedef ObjectLiteral::Property* ObjectLiteralProperty; | 383 typedef ObjectLiteral::Property* ObjectLiteralProperty; |
| 385 typedef ZoneList<v8::internal::Expression*>* ExpressionList; | 384 typedef ZoneList<v8::internal::Expression*>* ExpressionList; |
| 386 typedef ZoneList<ObjectLiteral::Property*>* PropertyList; | 385 typedef ZoneList<ObjectLiteral::Property*>* PropertyList; |
| 387 typedef ParserFormalParameters::Parameter FormalParameter; | 386 typedef ParserFormalParameters::Parameter FormalParameter; |
| 388 typedef ParserFormalParameters FormalParameters; | 387 typedef ParserFormalParameters FormalParameters; |
| 389 typedef ZoneList<v8::internal::Statement*>* StatementList; | 388 typedef ZoneList<v8::internal::Statement*>* StatementList; |
| 390 | 389 |
| 391 // For constructing objects returned by the traversing functions. | 390 // For constructing objects returned by the traversing functions. |
| 392 typedef AstNodeFactory Factory; | 391 typedef AstNodeFactory Factory; |
| 393 }; | 392 }; |
| 394 | 393 |
| 395 explicit ParserTraits(Parser* parser) : parser_(parser) {} | 394 // TODO(nikolaos): The traits methods should not need to call methods |
| 395 // of the implementation object. |
| 396 Parser* delegate() { return reinterpret_cast<Parser*>(this); } |
| 397 const Parser* delegate() const { |
| 398 return reinterpret_cast<const Parser*>(this); |
| 399 } |
| 396 | 400 |
| 397 // Helper functions for recursive descent. | 401 // Helper functions for recursive descent. |
| 398 bool IsEval(const AstRawString* identifier) const; | 402 bool IsEval(const AstRawString* identifier) const; |
| 399 bool IsArguments(const AstRawString* identifier) const; | 403 bool IsArguments(const AstRawString* identifier) const; |
| 400 bool IsEvalOrArguments(const AstRawString* identifier) const; | 404 bool IsEvalOrArguments(const AstRawString* identifier) const; |
| 401 bool IsUndefined(const AstRawString* identifier) const; | 405 bool IsUndefined(const AstRawString* identifier) const; |
| 402 bool IsAwait(const AstRawString* identifier) const; | 406 bool IsAwait(const AstRawString* identifier) const; |
| 403 V8_INLINE bool IsFutureStrictReserved(const AstRawString* identifier) const; | 407 V8_INLINE bool IsFutureStrictReserved(const AstRawString* identifier) const; |
| 404 | 408 |
| 405 // Returns true if the expression is of type "this.foo". | 409 // Returns true if the expression is of type "this.foo". |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 684 bool* ok); | 688 bool* ok); |
| 685 | 689 |
| 686 V8_INLINE ZoneList<typename Type::ExpressionClassifier::Error>* | 690 V8_INLINE ZoneList<typename Type::ExpressionClassifier::Error>* |
| 687 GetReportedErrorList() const; | 691 GetReportedErrorList() const; |
| 688 V8_INLINE Zone* zone() const; | 692 V8_INLINE Zone* zone() const; |
| 689 | 693 |
| 690 V8_INLINE ZoneList<Expression*>* GetNonPatternList() const; | 694 V8_INLINE ZoneList<Expression*>* GetNonPatternList() const; |
| 691 | 695 |
| 692 V8_INLINE Expression* RewriteYieldStar(Expression* generator, | 696 V8_INLINE Expression* RewriteYieldStar(Expression* generator, |
| 693 Expression* expression, int pos); | 697 Expression* expression, int pos); |
| 694 | |
| 695 private: | |
| 696 Parser* parser_; | |
| 697 }; | 698 }; |
| 698 | 699 |
| 699 | 700 |
| 700 class Parser : public ParserBase<ParserTraits> { | 701 class Parser : public ParserBase<Parser> { |
| 701 public: | 702 public: |
| 702 explicit Parser(ParseInfo* info); | 703 explicit Parser(ParseInfo* info); |
| 703 ~Parser() { | 704 ~Parser() { |
| 704 delete reusable_preparser_; | 705 delete reusable_preparser_; |
| 705 reusable_preparser_ = NULL; | 706 reusable_preparser_ = NULL; |
| 706 delete cached_parse_data_; | 707 delete cached_parse_data_; |
| 707 cached_parse_data_ = NULL; | 708 cached_parse_data_ = NULL; |
| 708 } | 709 } |
| 709 | 710 |
| 710 // Parses the source code represented by the compilation info and sets its | 711 // Parses the source code represented by the compilation info and sets its |
| 711 // function literal. Returns false (and deallocates any allocated AST | 712 // function literal. Returns false (and deallocates any allocated AST |
| 712 // nodes) if parsing failed. | 713 // nodes) if parsing failed. |
| 713 static bool ParseStatic(ParseInfo* info); | 714 static bool ParseStatic(ParseInfo* info); |
| 714 bool Parse(ParseInfo* info); | 715 bool Parse(ParseInfo* info); |
| 715 void ParseOnBackground(ParseInfo* info); | 716 void ParseOnBackground(ParseInfo* info); |
| 716 | 717 |
| 717 void DeserializeScopeChain(ParseInfo* info, Handle<Context> context, | 718 void DeserializeScopeChain(ParseInfo* info, Handle<Context> context, |
| 718 Scope::DeserializationMode deserialization_mode); | 719 Scope::DeserializationMode deserialization_mode); |
| 719 | 720 |
| 720 // Handle errors detected during parsing, move statistics to Isolate, | 721 // Handle errors detected during parsing, move statistics to Isolate, |
| 721 // internalize strings (move them to the heap). | 722 // internalize strings (move them to the heap). |
| 722 void Internalize(Isolate* isolate, Handle<Script> script, bool error); | 723 void Internalize(Isolate* isolate, Handle<Script> script, bool error); |
| 723 void HandleSourceURLComments(Isolate* isolate, Handle<Script> script); | 724 void HandleSourceURLComments(Isolate* isolate, Handle<Script> script); |
| 724 | 725 |
| 725 private: | 726 private: |
| 726 friend class ParserTraits; | 727 // TODO(nikolaos): This should not be necessary. It will be removed |
| 728 // when the traits object stops delegating to the implementation object. |
| 729 friend class ParserBaseTraits<Parser>; |
| 727 | 730 |
| 728 // Runtime encoding of different completion modes. | 731 // Runtime encoding of different completion modes. |
| 729 enum CompletionKind { | 732 enum CompletionKind { |
| 730 kNormalCompletion, | 733 kNormalCompletion, |
| 731 kThrowCompletion, | 734 kThrowCompletion, |
| 732 kAbruptCompletion | 735 kAbruptCompletion |
| 733 }; | 736 }; |
| 734 | 737 |
| 735 enum class FunctionBodyType { kNormal, kSingleExpression }; | 738 enum class FunctionBodyType { kNormal, kSingleExpression }; |
| 736 | 739 |
| (...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1179 HistogramTimer* pre_parse_timer_; | 1182 HistogramTimer* pre_parse_timer_; |
| 1180 | 1183 |
| 1181 bool parsing_on_main_thread_; | 1184 bool parsing_on_main_thread_; |
| 1182 | 1185 |
| 1183 #ifdef DEBUG | 1186 #ifdef DEBUG |
| 1184 void Print(AstNode* node); | 1187 void Print(AstNode* node); |
| 1185 #endif // DEBUG | 1188 #endif // DEBUG |
| 1186 }; | 1189 }; |
| 1187 | 1190 |
| 1188 | 1191 |
| 1189 bool ParserTraits::IsFutureStrictReserved( | 1192 bool ParserBaseTraits<Parser>::IsFutureStrictReserved( |
| 1190 const AstRawString* identifier) const { | 1193 const AstRawString* identifier) const { |
| 1191 return parser_->scanner()->IdentifierIsFutureStrictReserved(identifier); | 1194 return delegate()->scanner()->IdentifierIsFutureStrictReserved(identifier); |
| 1192 } | 1195 } |
| 1193 | 1196 |
| 1194 const AstRawString* ParserTraits::EmptyIdentifierString() const { | 1197 const AstRawString* ParserBaseTraits<Parser>::EmptyIdentifierString() const { |
| 1195 return parser_->ast_value_factory()->empty_string(); | 1198 return delegate()->ast_value_factory()->empty_string(); |
| 1199 } |
| 1200 |
| 1201 void ParserBaseTraits<Parser>::SkipLazyFunctionBody( |
| 1202 int* materialized_literal_count, int* expected_property_count, bool* ok, |
| 1203 Scanner::BookmarkScope* bookmark) { |
| 1204 return delegate()->SkipLazyFunctionBody( |
| 1205 materialized_literal_count, expected_property_count, ok, bookmark); |
| 1196 } | 1206 } |
| 1197 | 1207 |
| 1198 | 1208 |
| 1199 void ParserTraits::SkipLazyFunctionBody(int* materialized_literal_count, | 1209 ZoneList<Statement*>* ParserBaseTraits<Parser>::ParseEagerFunctionBody( |
| 1200 int* expected_property_count, bool* ok, | 1210 const AstRawString* name, int pos, const ParserFormalParameters& parameters, |
| 1201 Scanner::BookmarkScope* bookmark) { | 1211 FunctionKind kind, FunctionLiteral::FunctionType function_type, bool* ok) { |
| 1202 return parser_->SkipLazyFunctionBody(materialized_literal_count, | 1212 return delegate()->ParseEagerFunctionBody(name, pos, parameters, kind, |
| 1203 expected_property_count, ok, bookmark); | 1213 function_type, ok); |
| 1214 } |
| 1215 |
| 1216 void ParserBaseTraits<Parser>::CheckConflictingVarDeclarations(Scope* scope, |
| 1217 bool* ok) { |
| 1218 delegate()->CheckConflictingVarDeclarations(scope, ok); |
| 1204 } | 1219 } |
| 1205 | 1220 |
| 1206 | 1221 |
| 1207 ZoneList<Statement*>* ParserTraits::ParseEagerFunctionBody( | |
| 1208 const AstRawString* name, int pos, const ParserFormalParameters& parameters, | |
| 1209 FunctionKind kind, FunctionLiteral::FunctionType function_type, bool* ok) { | |
| 1210 return parser_->ParseEagerFunctionBody(name, pos, parameters, kind, | |
| 1211 function_type, ok); | |
| 1212 } | |
| 1213 | |
| 1214 void ParserTraits::CheckConflictingVarDeclarations(Scope* scope, bool* ok) { | |
| 1215 parser_->CheckConflictingVarDeclarations(scope, ok); | |
| 1216 } | |
| 1217 | |
| 1218 | |
| 1219 // Support for handling complex values (array and object literals) that | 1222 // Support for handling complex values (array and object literals) that |
| 1220 // can be fully handled at compile time. | 1223 // can be fully handled at compile time. |
| 1221 class CompileTimeValue: public AllStatic { | 1224 class CompileTimeValue: public AllStatic { |
| 1222 public: | 1225 public: |
| 1223 enum LiteralType { | 1226 enum LiteralType { |
| 1224 OBJECT_LITERAL_FAST_ELEMENTS, | 1227 OBJECT_LITERAL_FAST_ELEMENTS, |
| 1225 OBJECT_LITERAL_SLOW_ELEMENTS, | 1228 OBJECT_LITERAL_SLOW_ELEMENTS, |
| 1226 ARRAY_LITERAL | 1229 ARRAY_LITERAL |
| 1227 }; | 1230 }; |
| 1228 | 1231 |
| 1229 static bool IsCompileTimeValue(Expression* expression); | 1232 static bool IsCompileTimeValue(Expression* expression); |
| 1230 | 1233 |
| 1231 // Get the value as a compile time value. | 1234 // Get the value as a compile time value. |
| 1232 static Handle<FixedArray> GetValue(Isolate* isolate, Expression* expression); | 1235 static Handle<FixedArray> GetValue(Isolate* isolate, Expression* expression); |
| 1233 | 1236 |
| 1234 // Get the type of a compile time value returned by GetValue(). | 1237 // Get the type of a compile time value returned by GetValue(). |
| 1235 static LiteralType GetLiteralType(Handle<FixedArray> value); | 1238 static LiteralType GetLiteralType(Handle<FixedArray> value); |
| 1236 | 1239 |
| 1237 // Get the elements array of a compile time value returned by GetValue(). | 1240 // Get the elements array of a compile time value returned by GetValue(). |
| 1238 static Handle<FixedArray> GetElements(Handle<FixedArray> value); | 1241 static Handle<FixedArray> GetElements(Handle<FixedArray> value); |
| 1239 | 1242 |
| 1240 private: | 1243 private: |
| 1241 static const int kLiteralTypeSlot = 0; | 1244 static const int kLiteralTypeSlot = 0; |
| 1242 static const int kElementsSlot = 1; | 1245 static const int kElementsSlot = 1; |
| 1243 | 1246 |
| 1244 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); | 1247 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); |
| 1245 }; | 1248 }; |
| 1246 | 1249 |
| 1247 | 1250 ParserBaseTraits<Parser>::TemplateLiteralState |
| 1248 ParserTraits::TemplateLiteralState ParserTraits::OpenTemplateLiteral(int pos) { | 1251 ParserBaseTraits<Parser>::OpenTemplateLiteral(int pos) { |
| 1249 return parser_->OpenTemplateLiteral(pos); | 1252 return delegate()->OpenTemplateLiteral(pos); |
| 1250 } | 1253 } |
| 1251 | 1254 |
| 1252 | 1255 void ParserBaseTraits<Parser>::AddTemplateSpan(TemplateLiteralState* state, |
| 1253 void ParserTraits::AddTemplateSpan(TemplateLiteralState* state, bool tail) { | 1256 bool tail) { |
| 1254 parser_->AddTemplateSpan(state, tail); | 1257 delegate()->AddTemplateSpan(state, tail); |
| 1255 } | 1258 } |
| 1256 | 1259 |
| 1257 | 1260 void ParserBaseTraits<Parser>::AddTemplateExpression( |
| 1258 void ParserTraits::AddTemplateExpression(TemplateLiteralState* state, | 1261 TemplateLiteralState* state, Expression* expression) { |
| 1259 Expression* expression) { | 1262 delegate()->AddTemplateExpression(state, expression); |
| 1260 parser_->AddTemplateExpression(state, expression); | |
| 1261 } | 1263 } |
| 1262 | 1264 |
| 1263 | 1265 Expression* ParserBaseTraits<Parser>::CloseTemplateLiteral( |
| 1264 Expression* ParserTraits::CloseTemplateLiteral(TemplateLiteralState* state, | 1266 TemplateLiteralState* state, int start, Expression* tag) { |
| 1265 int start, Expression* tag) { | 1267 return delegate()->CloseTemplateLiteral(state, start, tag); |
| 1266 return parser_->CloseTemplateLiteral(state, start, tag); | |
| 1267 } | 1268 } |
| 1268 | 1269 |
| 1269 | 1270 ZoneList<v8::internal::Expression*>* ParserBaseTraits< |
| 1270 ZoneList<v8::internal::Expression*>* ParserTraits::PrepareSpreadArguments( | 1271 Parser>::PrepareSpreadArguments(ZoneList<v8::internal::Expression*>* list) { |
| 1271 ZoneList<v8::internal::Expression*>* list) { | 1272 return delegate()->PrepareSpreadArguments(list); |
| 1272 return parser_->PrepareSpreadArguments(list); | |
| 1273 } | 1273 } |
| 1274 | 1274 |
| 1275 | 1275 Expression* ParserBaseTraits<Parser>::SpreadCall( |
| 1276 Expression* ParserTraits::SpreadCall(Expression* function, | 1276 Expression* function, ZoneList<v8::internal::Expression*>* args, int pos) { |
| 1277 ZoneList<v8::internal::Expression*>* args, | 1277 return delegate()->SpreadCall(function, args, pos); |
| 1278 int pos) { | |
| 1279 return parser_->SpreadCall(function, args, pos); | |
| 1280 } | 1278 } |
| 1281 | 1279 |
| 1282 | 1280 Expression* ParserBaseTraits<Parser>::SpreadCallNew( |
| 1283 Expression* ParserTraits::SpreadCallNew( | |
| 1284 Expression* function, ZoneList<v8::internal::Expression*>* args, int pos) { | 1281 Expression* function, ZoneList<v8::internal::Expression*>* args, int pos) { |
| 1285 return parser_->SpreadCallNew(function, args, pos); | 1282 return delegate()->SpreadCallNew(function, args, pos); |
| 1286 } | 1283 } |
| 1287 | 1284 |
| 1288 | 1285 void ParserBaseTraits<Parser>::AddFormalParameter( |
| 1289 void ParserTraits::AddFormalParameter(ParserFormalParameters* parameters, | 1286 ParserFormalParameters* parameters, Expression* pattern, |
| 1290 Expression* pattern, | 1287 Expression* initializer, int initializer_end_position, bool is_rest) { |
| 1291 Expression* initializer, | |
| 1292 int initializer_end_position, | |
| 1293 bool is_rest) { | |
| 1294 bool is_simple = pattern->IsVariableProxy() && initializer == nullptr; | 1288 bool is_simple = pattern->IsVariableProxy() && initializer == nullptr; |
| 1295 const AstRawString* name = is_simple | 1289 const AstRawString* name = |
| 1296 ? pattern->AsVariableProxy()->raw_name() | 1290 is_simple ? pattern->AsVariableProxy()->raw_name() |
| 1297 : parser_->ast_value_factory()->empty_string(); | 1291 : delegate()->ast_value_factory()->empty_string(); |
| 1298 parameters->params.Add( | 1292 parameters->params.Add( |
| 1299 ParserFormalParameters::Parameter(name, pattern, initializer, | 1293 ParserFormalParameters::Parameter(name, pattern, initializer, |
| 1300 initializer_end_position, is_rest), | 1294 initializer_end_position, is_rest), |
| 1301 parameters->scope->zone()); | 1295 parameters->scope->zone()); |
| 1302 } | 1296 } |
| 1303 | 1297 |
| 1304 void ParserTraits::DeclareFormalParameter( | 1298 void ParserBaseTraits<Parser>::DeclareFormalParameter( |
| 1305 DeclarationScope* scope, const ParserFormalParameters::Parameter& parameter, | 1299 DeclarationScope* scope, const ParserFormalParameters::Parameter& parameter, |
| 1306 Type::ExpressionClassifier* classifier) { | 1300 Type::ExpressionClassifier* classifier) { |
| 1307 bool is_duplicate = false; | 1301 bool is_duplicate = false; |
| 1308 bool is_simple = classifier->is_simple_parameter_list(); | 1302 bool is_simple = classifier->is_simple_parameter_list(); |
| 1309 auto name = is_simple || parameter.is_rest | 1303 auto name = is_simple || parameter.is_rest |
| 1310 ? parameter.name | 1304 ? parameter.name |
| 1311 : parser_->ast_value_factory()->empty_string(); | 1305 : delegate()->ast_value_factory()->empty_string(); |
| 1312 auto mode = is_simple || parameter.is_rest ? VAR : TEMPORARY; | 1306 auto mode = is_simple || parameter.is_rest ? VAR : TEMPORARY; |
| 1313 if (!is_simple) scope->SetHasNonSimpleParameters(); | 1307 if (!is_simple) scope->SetHasNonSimpleParameters(); |
| 1314 bool is_optional = parameter.initializer != nullptr; | 1308 bool is_optional = parameter.initializer != nullptr; |
| 1315 Variable* var = | 1309 Variable* var = |
| 1316 scope->DeclareParameter(name, mode, is_optional, parameter.is_rest, | 1310 scope->DeclareParameter(name, mode, is_optional, parameter.is_rest, |
| 1317 &is_duplicate, parser_->ast_value_factory()); | 1311 &is_duplicate, delegate()->ast_value_factory()); |
| 1318 if (is_duplicate) { | 1312 if (is_duplicate) { |
| 1319 classifier->RecordDuplicateFormalParameterError( | 1313 classifier->RecordDuplicateFormalParameterError( |
| 1320 parser_->scanner()->location()); | 1314 delegate()->scanner()->location()); |
| 1321 } | 1315 } |
| 1322 if (is_sloppy(scope->language_mode())) { | 1316 if (is_sloppy(scope->language_mode())) { |
| 1323 // TODO(sigurds) Mark every parameter as maybe assigned. This is a | 1317 // TODO(sigurds) Mark every parameter as maybe assigned. This is a |
| 1324 // conservative approximation necessary to account for parameters | 1318 // conservative approximation necessary to account for parameters |
| 1325 // that are assigned via the arguments array. | 1319 // that are assigned via the arguments array. |
| 1326 var->set_maybe_assigned(); | 1320 var->set_maybe_assigned(); |
| 1327 } | 1321 } |
| 1328 } | 1322 } |
| 1329 | 1323 |
| 1330 void ParserTraits::AddParameterInitializationBlock( | 1324 void ParserBaseTraits<Parser>::AddParameterInitializationBlock( |
| 1331 const ParserFormalParameters& parameters, | 1325 const ParserFormalParameters& parameters, |
| 1332 ZoneList<v8::internal::Statement*>* body, bool is_async, bool* ok) { | 1326 ZoneList<v8::internal::Statement*>* body, bool is_async, bool* ok) { |
| 1333 if (!parameters.is_simple) { | 1327 if (!parameters.is_simple) { |
| 1334 auto* init_block = | 1328 auto* init_block = |
| 1335 parser_->BuildParameterInitializationBlock(parameters, ok); | 1329 delegate()->BuildParameterInitializationBlock(parameters, ok); |
| 1336 if (!*ok) return; | 1330 if (!*ok) return; |
| 1337 | 1331 |
| 1338 if (is_async) { | 1332 if (is_async) { |
| 1339 init_block = parser_->BuildRejectPromiseOnException(init_block); | 1333 init_block = delegate()->BuildRejectPromiseOnException(init_block); |
| 1340 } | 1334 } |
| 1341 | 1335 |
| 1342 if (init_block != nullptr) { | 1336 if (init_block != nullptr) { |
| 1343 body->Add(init_block, parser_->zone()); | 1337 body->Add(init_block, delegate()->zone()); |
| 1344 } | 1338 } |
| 1345 } | 1339 } |
| 1346 } | 1340 } |
| 1347 | 1341 |
| 1348 Expression* ParserTraits::ParseAsyncFunctionExpression(bool* ok) { | 1342 Expression* ParserBaseTraits<Parser>::ParseAsyncFunctionExpression(bool* ok) { |
| 1349 return parser_->ParseAsyncFunctionExpression(ok); | 1343 return delegate()->ParseAsyncFunctionExpression(ok); |
| 1350 } | 1344 } |
| 1351 | 1345 |
| 1352 DoExpression* ParserTraits::ParseDoExpression(bool* ok) { | 1346 DoExpression* ParserBaseTraits<Parser>::ParseDoExpression(bool* ok) { |
| 1353 return parser_->ParseDoExpression(ok); | 1347 return delegate()->ParseDoExpression(ok); |
| 1354 } | 1348 } |
| 1355 | 1349 |
| 1356 Expression* ParserTraits::RewriteYieldStar(Expression* generator, | 1350 Expression* ParserBaseTraits<Parser>::RewriteYieldStar(Expression* generator, |
| 1357 Expression* iterable, int pos) { | 1351 Expression* iterable, |
| 1358 return parser_->RewriteYieldStar(generator, iterable, pos); | 1352 int pos) { |
| 1353 return delegate()->RewriteYieldStar(generator, iterable, pos); |
| 1359 } | 1354 } |
| 1360 | 1355 |
| 1361 } // namespace internal | 1356 } // namespace internal |
| 1362 } // namespace v8 | 1357 } // namespace v8 |
| 1363 | 1358 |
| 1364 #endif // V8_PARSING_PARSER_H_ | 1359 #endif // V8_PARSING_PARSER_H_ |
| OLD | NEW |