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 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 Expression* current_value_; | 442 Expression* current_value_; |
443 int recursion_level_; | 443 int recursion_level_; |
444 bool* ok_; | 444 bool* ok_; |
445 | 445 |
446 DEFINE_AST_VISITOR_MEMBERS_WITHOUT_STACKOVERFLOW() | 446 DEFINE_AST_VISITOR_MEMBERS_WITHOUT_STACKOVERFLOW() |
447 }; | 447 }; |
448 | 448 |
449 // !%_IsJSReceiver(result = iterator.next()) && | 449 // !%_IsJSReceiver(result = iterator.next()) && |
450 // %ThrowIteratorResultNotAnObject(result) | 450 // %ThrowIteratorResultNotAnObject(result) |
451 Expression* BuildIteratorNextResult(Expression* iterator, Variable* result, | 451 Expression* BuildIteratorNextResult(Expression* iterator, Variable* result, |
452 int pos); | 452 IteratorType type, int pos); |
453 | 453 |
454 // Initialize the components of a for-in / for-of statement. | 454 // Initialize the components of a for-in / for-of statement. |
455 Statement* InitializeForEachStatement(ForEachStatement* stmt, | 455 Statement* InitializeForEachStatement(ForEachStatement* stmt, |
456 Expression* each, Expression* subject, | 456 Expression* each, Expression* subject, |
457 Statement* body, int each_keyword_pos); | 457 Statement* body, int each_keyword_pos); |
458 Statement* InitializeForOfStatement(ForOfStatement* stmt, Expression* each, | 458 Statement* InitializeForOfStatement(ForEachStatement* stmt, Expression* each, |
459 Expression* iterable, Statement* body, | 459 Expression* iterable, Statement* body, |
460 bool finalize, | 460 bool finalize, IteratorType type, |
461 int next_result_pos = kNoSourcePosition); | 461 int next_result_pos = kNoSourcePosition); |
| 462 |
462 Block* RewriteForVarInLegacy(const ForInfo& for_info); | 463 Block* RewriteForVarInLegacy(const ForInfo& for_info); |
463 void DesugarBindingInForEachStatement(ForInfo* for_info, Block** body_block, | 464 void DesugarBindingInForEachStatement(ForInfo* for_info, Block** body_block, |
464 Expression** each_variable, bool* ok); | 465 Expression** each_variable, bool* ok); |
465 Block* CreateForEachStatementTDZ(Block* init_block, const ForInfo& for_info, | 466 Block* CreateForEachStatementTDZ(Block* init_block, const ForInfo& for_info, |
466 bool* ok); | 467 bool* ok); |
467 | 468 |
468 Statement* DesugarLexicalBindingsInForStatement( | 469 Statement* DesugarLexicalBindingsInForStatement( |
469 ForStatement* loop, Statement* init, Expression* cond, Statement* next, | 470 ForStatement* loop, Statement* init, Expression* cond, Statement* next, |
470 Statement* body, Scope* inner_scope, const ForInfo& for_info, bool* ok); | 471 Statement* body, Scope* inner_scope, const ForInfo& for_info, bool* ok); |
471 | 472 |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
629 Expression* BuildRejectPromise(Expression* value, int pos); | 630 Expression* BuildRejectPromise(Expression* value, int pos); |
630 Variable* PromiseVariable(); | 631 Variable* PromiseVariable(); |
631 | 632 |
632 // Generic AST generator for throwing errors from compiled code. | 633 // Generic AST generator for throwing errors from compiled code. |
633 Expression* NewThrowError(Runtime::FunctionId function_id, | 634 Expression* NewThrowError(Runtime::FunctionId function_id, |
634 MessageTemplate::Template message, | 635 MessageTemplate::Template message, |
635 const AstRawString* arg, int pos); | 636 const AstRawString* arg, int pos); |
636 | 637 |
637 void FinalizeIteratorUse(Scope* use_scope, Variable* completion, | 638 void FinalizeIteratorUse(Scope* use_scope, Variable* completion, |
638 Expression* condition, Variable* iter, | 639 Expression* condition, Variable* iter, |
639 Block* iterator_use, Block* result); | 640 Block* iterator_use, Block* result, |
| 641 IteratorType type); |
640 | 642 |
641 Statement* FinalizeForOfStatement(ForOfStatement* loop, Variable* completion, | 643 Statement* FinalizeForOfStatement(ForOfStatement* loop, Variable* completion, |
642 int pos); | 644 IteratorType type, int pos); |
643 void BuildIteratorClose(ZoneList<Statement*>* statements, Variable* iterator, | 645 void BuildIteratorClose(ZoneList<Statement*>* statements, Variable* iterator, |
644 Variable* input, Variable* output); | 646 Variable* input, Variable* output); |
645 void BuildIteratorCloseForCompletion(Scope* scope, | 647 void BuildIteratorCloseForCompletion(Scope* scope, |
646 ZoneList<Statement*>* statements, | 648 ZoneList<Statement*>* statements, |
647 Variable* iterator, | 649 Variable* iterator, |
648 Expression* completion); | 650 Expression* completion, |
| 651 IteratorType type); |
649 Statement* CheckCallable(Variable* var, Expression* error, int pos); | 652 Statement* CheckCallable(Variable* var, Expression* error, int pos); |
650 | 653 |
651 V8_INLINE Expression* RewriteAwaitExpression(Expression* value, int pos); | 654 V8_INLINE Expression* RewriteAwaitExpression(Expression* value, int pos); |
652 V8_INLINE void PrepareAsyncFunctionBody(ZoneList<Statement*>* body, | 655 V8_INLINE void PrepareAsyncFunctionBody(ZoneList<Statement*>* body, |
653 FunctionKind kind, int pos); | 656 FunctionKind kind, int pos); |
654 V8_INLINE void RewriteAsyncFunctionBody(ZoneList<Statement*>* body, | 657 V8_INLINE void RewriteAsyncFunctionBody(ZoneList<Statement*>* body, |
655 Block* block, | 658 Block* block, |
656 Expression* return_value, bool* ok); | 659 Expression* return_value, bool* ok); |
657 | 660 |
658 Expression* RewriteYieldStar(Expression* generator, Expression* expression, | 661 Expression* RewriteYieldStar(Expression* generator, Expression* expression, |
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1175 | 1178 |
1176 private: | 1179 private: |
1177 ParserTarget** variable_; | 1180 ParserTarget** variable_; |
1178 ParserTarget* previous_; | 1181 ParserTarget* previous_; |
1179 }; | 1182 }; |
1180 | 1183 |
1181 } // namespace internal | 1184 } // namespace internal |
1182 } // namespace v8 | 1185 } // namespace v8 |
1183 | 1186 |
1184 #endif // V8_PARSING_PARSER_H_ | 1187 #endif // V8_PARSING_PARSER_H_ |
OLD | NEW |