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

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: ...and uncomment the previously failing tests... 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
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 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
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,
nickie 2017/02/14 13:35:24 Maybe it's trivial, but it strikes me as odd that
caitp 2017/02/14 14:16:37 The purpose was to allow InitializeForOfStatement
adamk 2017/02/14 18:47:53 I can think of a variety of solutions for this tha
caitp 2017/02/14 21:40:58 Done via NewForOf...
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
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
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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698