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/ast/ast.h" | 8 #include "src/ast/ast.h" |
9 #include "src/ast/scopes.h" | 9 #include "src/ast/scopes.h" |
10 #include "src/base/compiler-specific.h" | 10 #include "src/base/compiler-specific.h" |
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
449 Block* block_; | 449 Block* block_; |
450 const DeclarationDescriptor* descriptor_; | 450 const DeclarationDescriptor* descriptor_; |
451 ZoneList<const AstRawString*>* names_; | 451 ZoneList<const AstRawString*>* names_; |
452 Expression* current_value_; | 452 Expression* current_value_; |
453 int recursion_level_; | 453 int recursion_level_; |
454 bool* ok_; | 454 bool* ok_; |
455 | 455 |
456 DEFINE_AST_VISITOR_MEMBERS_WITHOUT_STACKOVERFLOW() | 456 DEFINE_AST_VISITOR_MEMBERS_WITHOUT_STACKOVERFLOW() |
457 }; | 457 }; |
458 | 458 |
459 // !%_IsJSReceiver(result = iterator.next()) && | 459 // [if (IteratorType == kAsync)] |
460 // %ThrowIteratorResultNotAnObject(result) | 460 // !%_IsJSReceiver(result = Await(iterator.next()) && |
| 461 // %ThrowIteratorResultNotAnObject(result) |
| 462 // [else] |
| 463 // !%_IsJSReceiver(result = iterator.next()) && |
| 464 // %ThrowIteratorResultNotAnObject(result) |
| 465 // [endif] |
461 Expression* BuildIteratorNextResult(Expression* iterator, Variable* result, | 466 Expression* BuildIteratorNextResult(Expression* iterator, Variable* result, |
462 int pos); | 467 IteratorType type, int pos); |
463 | 468 |
464 // Initialize the components of a for-in / for-of statement. | 469 // Initialize the components of a for-in / for-of statement. |
465 Statement* InitializeForEachStatement(ForEachStatement* stmt, | 470 Statement* InitializeForEachStatement(ForEachStatement* stmt, |
466 Expression* each, Expression* subject, | 471 Expression* each, Expression* subject, |
467 Statement* body, int each_keyword_pos); | 472 Statement* body, int each_keyword_pos); |
468 Statement* InitializeForOfStatement(ForOfStatement* stmt, Expression* each, | 473 Statement* InitializeForOfStatement(ForEachStatement* stmt, Expression* each, |
469 Expression* iterable, Statement* body, | 474 Expression* iterable, Statement* body, |
470 bool finalize, | 475 bool finalize, IteratorType type, |
471 int next_result_pos = kNoSourcePosition); | 476 int next_result_pos = kNoSourcePosition); |
| 477 |
472 Block* RewriteForVarInLegacy(const ForInfo& for_info); | 478 Block* RewriteForVarInLegacy(const ForInfo& for_info); |
473 void DesugarBindingInForEachStatement(ForInfo* for_info, Block** body_block, | 479 void DesugarBindingInForEachStatement(ForInfo* for_info, Block** body_block, |
474 Expression** each_variable, bool* ok); | 480 Expression** each_variable, bool* ok); |
475 Block* CreateForEachStatementTDZ(Block* init_block, const ForInfo& for_info, | 481 Block* CreateForEachStatementTDZ(Block* init_block, const ForInfo& for_info, |
476 bool* ok); | 482 bool* ok); |
477 | 483 |
478 Statement* DesugarLexicalBindingsInForStatement( | 484 Statement* DesugarLexicalBindingsInForStatement( |
479 ForStatement* loop, Statement* init, Expression* cond, Statement* next, | 485 ForStatement* loop, Statement* init, Expression* cond, Statement* next, |
480 Statement* body, Scope* inner_scope, const ForInfo& for_info, bool* ok); | 486 Statement* body, Scope* inner_scope, const ForInfo& for_info, bool* ok); |
481 | 487 |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
633 Expression* BuildRejectPromise(Expression* value, int pos); | 639 Expression* BuildRejectPromise(Expression* value, int pos); |
634 Variable* PromiseVariable(); | 640 Variable* PromiseVariable(); |
635 | 641 |
636 // Generic AST generator for throwing errors from compiled code. | 642 // Generic AST generator for throwing errors from compiled code. |
637 Expression* NewThrowError(Runtime::FunctionId function_id, | 643 Expression* NewThrowError(Runtime::FunctionId function_id, |
638 MessageTemplate::Template message, | 644 MessageTemplate::Template message, |
639 const AstRawString* arg, int pos); | 645 const AstRawString* arg, int pos); |
640 | 646 |
641 void FinalizeIteratorUse(Scope* use_scope, Variable* completion, | 647 void FinalizeIteratorUse(Scope* use_scope, Variable* completion, |
642 Expression* condition, Variable* iter, | 648 Expression* condition, Variable* iter, |
643 Block* iterator_use, Block* result); | 649 Block* iterator_use, Block* result, |
| 650 IteratorType type); |
644 | 651 |
645 Statement* FinalizeForOfStatement(ForOfStatement* loop, Variable* completion, | 652 Statement* FinalizeForOfStatement(ForOfStatement* loop, Variable* completion, |
646 int pos); | 653 IteratorType type, int pos); |
647 void BuildIteratorClose(ZoneList<Statement*>* statements, Variable* iterator, | 654 void BuildIteratorClose(ZoneList<Statement*>* statements, Variable* iterator, |
648 Variable* input, Variable* output); | 655 Variable* input, Variable* output); |
649 void BuildIteratorCloseForCompletion(Scope* scope, | 656 void BuildIteratorCloseForCompletion(Scope* scope, |
650 ZoneList<Statement*>* statements, | 657 ZoneList<Statement*>* statements, |
651 Variable* iterator, | 658 Variable* iterator, |
652 Expression* completion); | 659 Expression* completion, |
| 660 IteratorType type); |
653 Statement* CheckCallable(Variable* var, Expression* error, int pos); | 661 Statement* CheckCallable(Variable* var, Expression* error, int pos); |
654 | 662 |
655 V8_INLINE Expression* RewriteAwaitExpression(Expression* value, int pos); | 663 V8_INLINE Expression* RewriteAwaitExpression(Expression* value, int pos); |
656 V8_INLINE void PrepareAsyncFunctionBody(ZoneList<Statement*>* body, | 664 V8_INLINE void PrepareAsyncFunctionBody(ZoneList<Statement*>* body, |
657 FunctionKind kind, int pos); | 665 FunctionKind kind, int pos); |
658 V8_INLINE void RewriteAsyncFunctionBody(ZoneList<Statement*>* body, | 666 V8_INLINE void RewriteAsyncFunctionBody(ZoneList<Statement*>* body, |
659 Block* block, | 667 Block* block, |
660 Expression* return_value, bool* ok); | 668 Expression* return_value, bool* ok); |
661 | 669 |
662 Expression* RewriteYieldStar(Expression* generator, Expression* expression, | 670 Expression* RewriteYieldStar(Expression* generator, Expression* expression, |
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1178 | 1186 |
1179 private: | 1187 private: |
1180 ParserTarget** variable_; | 1188 ParserTarget** variable_; |
1181 ParserTarget* previous_; | 1189 ParserTarget* previous_; |
1182 }; | 1190 }; |
1183 | 1191 |
1184 } // namespace internal | 1192 } // namespace internal |
1185 } // namespace v8 | 1193 } // namespace v8 |
1186 | 1194 |
1187 #endif // V8_PARSING_PARSER_H_ | 1195 #endif // V8_PARSING_PARSER_H_ |
OLD | NEW |