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

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

Issue 2622833002: WIP [esnext] implement async iteration proposal (Closed)
Patch Set: Make (most of) for-await-of work (no IteratorClose yet..) 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 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 int recursion_level_; 442 int recursion_level_;
443 bool* ok_; 443 bool* ok_;
444 444
445 DEFINE_AST_VISITOR_MEMBERS_WITHOUT_STACKOVERFLOW() 445 DEFINE_AST_VISITOR_MEMBERS_WITHOUT_STACKOVERFLOW()
446 }; 446 };
447 447
448 // !%_IsJSReceiver(result = iterator.next()) && 448 // !%_IsJSReceiver(result = iterator.next()) &&
449 // %ThrowIteratorResultNotAnObject(result) 449 // %ThrowIteratorResultNotAnObject(result)
450 Expression* BuildIteratorNextResult(Expression* iterator, Variable* result, 450 Expression* BuildIteratorNextResult(Expression* iterator, Variable* result,
451 int pos); 451 int pos);
452 Expression* AwaitIteratorNextResult(Expression* iterator, Variable* result,
453 int pos);
452 454
453 // Initialize the components of a for-in / for-of statement. 455 // Initialize the components of a for-in / for-of statement.
454 Statement* InitializeForEachStatement(ForEachStatement* stmt, 456 Statement* InitializeForEachStatement(ForEachStatement* stmt,
455 Expression* each, Expression* subject, 457 Expression* each, Expression* subject,
456 Statement* body, int each_keyword_pos); 458 Statement* body, int each_keyword_pos);
457 Statement* InitializeForOfStatement(ForOfStatement* stmt, Expression* each, 459 Statement* InitializeForOfStatement(ForOfStatement* stmt, Expression* each,
458 Expression* iterable, Statement* body, 460 Expression* iterable, Statement* body,
459 bool finalize, 461 bool finalize,
460 int next_result_pos = kNoSourcePosition); 462 int next_result_pos = kNoSourcePosition);
463 Statement* InitializeForAwaitOfStatement(
464 ForEachStatement* for_of, Expression* each, Expression* iterable,
465 Statement* body, bool finalize, int next_result_pos = kNoSourcePosition);
461 Block* RewriteForVarInLegacy(const ForInfo& for_info); 466 Block* RewriteForVarInLegacy(const ForInfo& for_info);
462 void DesugarBindingInForEachStatement(ForInfo* for_info, Block** body_block, 467 void DesugarBindingInForEachStatement(ForInfo* for_info, Block** body_block,
463 Expression** each_variable, bool* ok); 468 Expression** each_variable, bool* ok);
464 Block* CreateForEachStatementTDZ(Block* init_block, const ForInfo& for_info, 469 Block* CreateForEachStatementTDZ(Block* init_block, const ForInfo& for_info,
465 bool* ok); 470 bool* ok);
466 471
467 Statement* DesugarLexicalBindingsInForStatement( 472 Statement* DesugarLexicalBindingsInForStatement(
468 ForStatement* loop, Statement* init, Expression* cond, Statement* next, 473 ForStatement* loop, Statement* init, Expression* cond, Statement* next,
469 Statement* body, Scope* inner_scope, const ForInfo& for_info, bool* ok); 474 Statement* body, Scope* inner_scope, const ForInfo& for_info, bool* ok);
470 475
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
632 Expression* NewThrowError(Runtime::FunctionId function_id, 637 Expression* NewThrowError(Runtime::FunctionId function_id,
633 MessageTemplate::Template message, 638 MessageTemplate::Template message,
634 const AstRawString* arg, int pos); 639 const AstRawString* arg, int pos);
635 640
636 void FinalizeIteratorUse(Scope* use_scope, Variable* completion, 641 void FinalizeIteratorUse(Scope* use_scope, Variable* completion,
637 Expression* condition, Variable* iter, 642 Expression* condition, Variable* iter,
638 Block* iterator_use, Block* result); 643 Block* iterator_use, Block* result);
639 644
640 Statement* FinalizeForOfStatement(ForOfStatement* loop, Variable* completion, 645 Statement* FinalizeForOfStatement(ForOfStatement* loop, Variable* completion,
641 int pos); 646 int pos);
647 Statement* FinalizeForAwaitOfStatement(ForOfStatement* loop,
648 Variable* completion, int pos);
642 void BuildIteratorClose(ZoneList<Statement*>* statements, Variable* iterator, 649 void BuildIteratorClose(ZoneList<Statement*>* statements, Variable* iterator,
643 Variable* input, Variable* output); 650 Variable* input, Variable* output);
644 void BuildIteratorCloseForCompletion(Scope* scope, 651 void BuildIteratorCloseForCompletion(Scope* scope,
645 ZoneList<Statement*>* statements, 652 ZoneList<Statement*>* statements,
646 Variable* iterator, 653 Variable* iterator,
647 Expression* completion); 654 Expression* completion);
648 Statement* CheckCallable(Variable* var, Expression* error, int pos); 655 Statement* CheckCallable(Variable* var, Expression* error, int pos);
649 656
650 V8_INLINE Expression* RewriteAwaitExpression(Expression* value, int pos); 657 V8_INLINE Expression* RewriteAwaitExpression(Expression* value, int pos);
651 V8_INLINE void PrepareAsyncFunctionBody(ZoneList<Statement*>* body, 658 V8_INLINE void PrepareAsyncFunctionBody(ZoneList<Statement*>* body,
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after
1174 1181
1175 private: 1182 private:
1176 ParserTarget** variable_; 1183 ParserTarget** variable_;
1177 ParserTarget* previous_; 1184 ParserTarget* previous_;
1178 }; 1185 };
1179 1186
1180 } // namespace internal 1187 } // namespace internal
1181 } // namespace v8 1188 } // namespace v8
1182 1189
1183 #endif // V8_PARSING_PARSER_H_ 1190 #endif // V8_PARSING_PARSER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698