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

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

Powered by Google App Engine
This is Rietveld 408576698