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

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

Issue 2637403008: [async-iteration] add support for for-await-of loops in Async Functions (Closed)
Patch Set: remove that comment Created 3 years, 10 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/messages.h ('k') | src/parsing/parser.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_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 444 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 Block* block_; 455 Block* block_;
456 const DeclarationDescriptor* descriptor_; 456 const DeclarationDescriptor* descriptor_;
457 ZoneList<const AstRawString*>* names_; 457 ZoneList<const AstRawString*>* names_;
458 Expression* current_value_; 458 Expression* current_value_;
459 int recursion_level_; 459 int recursion_level_;
460 bool* ok_; 460 bool* ok_;
461 461
462 DEFINE_AST_VISITOR_MEMBERS_WITHOUT_STACKOVERFLOW() 462 DEFINE_AST_VISITOR_MEMBERS_WITHOUT_STACKOVERFLOW()
463 }; 463 };
464 464
465 // !%_IsJSReceiver(result = iterator.next()) && 465 // [if (IteratorType == kAsync)]
466 // %ThrowIteratorResultNotAnObject(result) 466 // !%_IsJSReceiver(result = Await(iterator.next()) &&
467 // %ThrowIteratorResultNotAnObject(result)
468 // [else]
469 // !%_IsJSReceiver(result = iterator.next()) &&
470 // %ThrowIteratorResultNotAnObject(result)
471 // [endif]
467 Expression* BuildIteratorNextResult(Expression* iterator, Variable* result, 472 Expression* BuildIteratorNextResult(Expression* iterator, Variable* result,
468 int pos); 473 IteratorType type, int pos);
469 474
470 // Initialize the components of a for-in / for-of statement. 475 // Initialize the components of a for-in / for-of statement.
471 Statement* InitializeForEachStatement(ForEachStatement* stmt, 476 Statement* InitializeForEachStatement(ForEachStatement* stmt,
472 Expression* each, Expression* subject, 477 Expression* each, Expression* subject,
473 Statement* body, int each_keyword_pos); 478 Statement* body, int each_keyword_pos);
474 Statement* InitializeForOfStatement(ForOfStatement* stmt, Expression* each, 479 Statement* InitializeForOfStatement(ForOfStatement* stmt, Expression* each,
475 Expression* iterable, Statement* body, 480 Expression* iterable, Statement* body,
476 bool finalize, 481 bool finalize, IteratorType type,
477 int next_result_pos = kNoSourcePosition); 482 int next_result_pos = kNoSourcePosition);
483
478 Block* RewriteForVarInLegacy(const ForInfo& for_info); 484 Block* RewriteForVarInLegacy(const ForInfo& for_info);
479 void DesugarBindingInForEachStatement(ForInfo* for_info, Block** body_block, 485 void DesugarBindingInForEachStatement(ForInfo* for_info, Block** body_block,
480 Expression** each_variable, bool* ok); 486 Expression** each_variable, bool* ok);
481 Block* CreateForEachStatementTDZ(Block* init_block, const ForInfo& for_info, 487 Block* CreateForEachStatementTDZ(Block* init_block, const ForInfo& for_info,
482 bool* ok); 488 bool* ok);
483 489
484 Statement* DesugarLexicalBindingsInForStatement( 490 Statement* DesugarLexicalBindingsInForStatement(
485 ForStatement* loop, Statement* init, Expression* cond, Statement* next, 491 ForStatement* loop, Statement* init, Expression* cond, Statement* next,
486 Statement* body, Scope* inner_scope, const ForInfo& for_info, bool* ok); 492 Statement* body, Scope* inner_scope, const ForInfo& for_info, bool* ok);
487 493
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
639 Expression* BuildRejectPromise(Expression* value, int pos); 645 Expression* BuildRejectPromise(Expression* value, int pos);
640 Variable* PromiseVariable(); 646 Variable* PromiseVariable();
641 647
642 // Generic AST generator for throwing errors from compiled code. 648 // Generic AST generator for throwing errors from compiled code.
643 Expression* NewThrowError(Runtime::FunctionId function_id, 649 Expression* NewThrowError(Runtime::FunctionId function_id,
644 MessageTemplate::Template message, 650 MessageTemplate::Template message,
645 const AstRawString* arg, int pos); 651 const AstRawString* arg, int pos);
646 652
647 void FinalizeIteratorUse(Scope* use_scope, Variable* completion, 653 void FinalizeIteratorUse(Scope* use_scope, Variable* completion,
648 Expression* condition, Variable* iter, 654 Expression* condition, Variable* iter,
649 Block* iterator_use, Block* result); 655 Block* iterator_use, Block* result,
656 IteratorType type);
650 657
651 Statement* FinalizeForOfStatement(ForOfStatement* loop, Variable* completion, 658 Statement* FinalizeForOfStatement(ForOfStatement* loop, Variable* completion,
652 int pos); 659 IteratorType type, int pos);
653 void BuildIteratorClose(ZoneList<Statement*>* statements, Variable* iterator, 660 void BuildIteratorClose(ZoneList<Statement*>* statements, Variable* iterator,
654 Variable* input, Variable* output); 661 Variable* input, Variable* output);
655 void BuildIteratorCloseForCompletion(Scope* scope, 662 void BuildIteratorCloseForCompletion(Scope* scope,
656 ZoneList<Statement*>* statements, 663 ZoneList<Statement*>* statements,
657 Variable* iterator, 664 Variable* iterator,
658 Expression* completion); 665 Expression* completion,
666 IteratorType type);
659 Statement* CheckCallable(Variable* var, Expression* error, int pos); 667 Statement* CheckCallable(Variable* var, Expression* error, int pos);
660 668
661 V8_INLINE Expression* RewriteAwaitExpression(Expression* value, int pos); 669 V8_INLINE Expression* RewriteAwaitExpression(Expression* value, int pos);
662 V8_INLINE void PrepareAsyncFunctionBody(ZoneList<Statement*>* body, 670 V8_INLINE void PrepareAsyncFunctionBody(ZoneList<Statement*>* body,
663 FunctionKind kind, int pos); 671 FunctionKind kind, int pos);
664 V8_INLINE void RewriteAsyncFunctionBody(ZoneList<Statement*>* body, 672 V8_INLINE void RewriteAsyncFunctionBody(ZoneList<Statement*>* body,
665 Block* block, 673 Block* block,
666 Expression* return_value, bool* ok); 674 Expression* return_value, bool* ok);
667 675
668 Expression* RewriteYieldStar(Expression* generator, Expression* expression, 676 Expression* RewriteYieldStar(Expression* generator, Expression* expression,
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after
1183 1191
1184 private: 1192 private:
1185 ParserTarget** variable_; 1193 ParserTarget** variable_;
1186 ParserTarget* previous_; 1194 ParserTarget* previous_;
1187 }; 1195 };
1188 1196
1189 } // namespace internal 1197 } // namespace internal
1190 } // namespace v8 1198 } // namespace v8
1191 1199
1192 #endif // V8_PARSING_PARSER_H_ 1200 #endif // V8_PARSING_PARSER_H_
OLDNEW
« no previous file with comments | « src/messages.h ('k') | src/parsing/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698