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/parsing/parser-base.h" | 10 #include "src/parsing/parser-base.h" |
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
636 // In this case, it'll reset the scanner using the bookmark. | 636 // In this case, it'll reset the scanner using the bookmark. |
637 void SkipLazyFunctionBody(int* materialized_literal_count, | 637 void SkipLazyFunctionBody(int* materialized_literal_count, |
638 int* expected_property_count, bool* ok, | 638 int* expected_property_count, bool* ok, |
639 Scanner::BookmarkScope* bookmark = nullptr); | 639 Scanner::BookmarkScope* bookmark = nullptr); |
640 | 640 |
641 PreParser::PreParseResult ParseLazyFunctionBodyWithPreParser( | 641 PreParser::PreParseResult ParseLazyFunctionBodyWithPreParser( |
642 SingletonLogger* logger, Scanner::BookmarkScope* bookmark = nullptr); | 642 SingletonLogger* logger, Scanner::BookmarkScope* bookmark = nullptr); |
643 | 643 |
644 Block* BuildParameterInitializationBlock( | 644 Block* BuildParameterInitializationBlock( |
645 const ParserFormalParameters& parameters, bool* ok); | 645 const ParserFormalParameters& parameters, bool* ok); |
646 Block* BuildRejectPromiseOnException(Block* block); | 646 Block* BuildRejectPromiseOnException(Block* block, bool* ok); |
647 | 647 |
648 // Consumes the ending }. | 648 // Consumes the ending }. |
649 ZoneList<Statement*>* ParseEagerFunctionBody( | 649 ZoneList<Statement*>* ParseEagerFunctionBody( |
650 const AstRawString* function_name, int pos, | 650 const AstRawString* function_name, int pos, |
651 const ParserFormalParameters& parameters, FunctionKind kind, | 651 const ParserFormalParameters& parameters, FunctionKind kind, |
652 FunctionLiteral::FunctionType function_type, bool* ok); | 652 FunctionLiteral::FunctionType function_type, bool* ok); |
653 | 653 |
654 void ThrowPendingError(Isolate* isolate, Handle<Script> script); | 654 void ThrowPendingError(Isolate* isolate, Handle<Script> script); |
655 | 655 |
656 class TemplateLiteral : public ZoneObject { | 656 class TemplateLiteral : public ZoneObject { |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
730 V8_INLINE void RewriteNonPattern(ExpressionClassifier* classifier, bool* ok); | 730 V8_INLINE void RewriteNonPattern(ExpressionClassifier* classifier, bool* ok); |
731 | 731 |
732 V8_INLINE void QueueDestructuringAssignmentForRewriting( | 732 V8_INLINE void QueueDestructuringAssignmentForRewriting( |
733 Expression* assignment); | 733 Expression* assignment); |
734 V8_INLINE void QueueNonPatternForRewriting(Expression* expr, bool* ok); | 734 V8_INLINE void QueueNonPatternForRewriting(Expression* expr, bool* ok); |
735 | 735 |
736 friend class InitializerRewriter; | 736 friend class InitializerRewriter; |
737 void RewriteParameterInitializer(Expression* expr, Scope* scope); | 737 void RewriteParameterInitializer(Expression* expr, Scope* scope); |
738 | 738 |
739 Expression* BuildCreateJSGeneratorObject(int pos, FunctionKind kind); | 739 Expression* BuildCreateJSGeneratorObject(int pos, FunctionKind kind); |
740 Expression* BuildPromiseResolve(Expression* value, int pos); | 740 Expression* BuildResolvePromise(Expression* value, int pos); |
741 Expression* BuildPromiseReject(Expression* value, int pos); | 741 Expression* BuildRejectPromise(Expression* value, int pos); |
| 742 VariableProxy* BuildDotPromise(); |
| 743 VariableProxy* BuildDotDebugIsActive(); |
742 | 744 |
743 // Generic AST generator for throwing errors from compiled code. | 745 // Generic AST generator for throwing errors from compiled code. |
744 Expression* NewThrowError(Runtime::FunctionId function_id, | 746 Expression* NewThrowError(Runtime::FunctionId function_id, |
745 MessageTemplate::Template message, | 747 MessageTemplate::Template message, |
746 const AstRawString* arg, int pos); | 748 const AstRawString* arg, int pos); |
747 | 749 |
748 void FinalizeIteratorUse(Variable* completion, Expression* condition, | 750 void FinalizeIteratorUse(Variable* completion, Expression* condition, |
749 Variable* iter, Block* iterator_use, Block* result); | 751 Variable* iter, Block* iterator_use, Block* result); |
750 | 752 |
751 Statement* FinalizeForOfStatement(ForOfStatement* loop, Variable* completion, | 753 Statement* FinalizeForOfStatement(ForOfStatement* loop, Variable* completion, |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1071 | 1073 |
1072 void ParserBaseTraits<Parser>::AddParameterInitializationBlock( | 1074 void ParserBaseTraits<Parser>::AddParameterInitializationBlock( |
1073 const ParserFormalParameters& parameters, | 1075 const ParserFormalParameters& parameters, |
1074 ZoneList<v8::internal::Statement*>* body, bool is_async, bool* ok) { | 1076 ZoneList<v8::internal::Statement*>* body, bool is_async, bool* ok) { |
1075 if (!parameters.is_simple) { | 1077 if (!parameters.is_simple) { |
1076 auto* init_block = | 1078 auto* init_block = |
1077 delegate()->BuildParameterInitializationBlock(parameters, ok); | 1079 delegate()->BuildParameterInitializationBlock(parameters, ok); |
1078 if (!*ok) return; | 1080 if (!*ok) return; |
1079 | 1081 |
1080 if (is_async) { | 1082 if (is_async) { |
1081 init_block = delegate()->BuildRejectPromiseOnException(init_block); | 1083 init_block = delegate()->BuildRejectPromiseOnException(init_block, ok); |
| 1084 if (!*ok) return; |
1082 } | 1085 } |
1083 | 1086 |
1084 if (init_block != nullptr) { | 1087 if (init_block != nullptr) { |
1085 body->Add(init_block, delegate()->zone()); | 1088 body->Add(init_block, delegate()->zone()); |
1086 } | 1089 } |
1087 } | 1090 } |
1088 } | 1091 } |
1089 | 1092 |
1090 } // namespace internal | 1093 } // namespace internal |
1091 } // namespace v8 | 1094 } // namespace v8 |
1092 | 1095 |
1093 #endif // V8_PARSING_PARSER_H_ | 1096 #endif // V8_PARSING_PARSER_H_ |
OLD | NEW |