| 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 750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 761 // In this case, it'll reset the scanner using the bookmark. | 761 // In this case, it'll reset the scanner using the bookmark. |
| 762 void SkipLazyFunctionBody(int* materialized_literal_count, | 762 void SkipLazyFunctionBody(int* materialized_literal_count, |
| 763 int* expected_property_count, bool* ok, | 763 int* expected_property_count, bool* ok, |
| 764 Scanner::BookmarkScope* bookmark = nullptr); | 764 Scanner::BookmarkScope* bookmark = nullptr); |
| 765 | 765 |
| 766 PreParser::PreParseResult ParseLazyFunctionBodyWithPreParser( | 766 PreParser::PreParseResult ParseLazyFunctionBodyWithPreParser( |
| 767 SingletonLogger* logger, Scanner::BookmarkScope* bookmark = nullptr); | 767 SingletonLogger* logger, Scanner::BookmarkScope* bookmark = nullptr); |
| 768 | 768 |
| 769 Block* BuildParameterInitializationBlock( | 769 Block* BuildParameterInitializationBlock( |
| 770 const ParserFormalParameters& parameters, bool* ok); | 770 const ParserFormalParameters& parameters, bool* ok); |
| 771 Block* BuildRejectPromiseOnException(Block* block); | 771 Block* BuildRejectPromiseOnException(Block* block, bool* ok); |
| 772 | 772 |
| 773 // Consumes the ending }. | 773 // Consumes the ending }. |
| 774 ZoneList<Statement*>* ParseEagerFunctionBody( | 774 ZoneList<Statement*>* ParseEagerFunctionBody( |
| 775 const AstRawString* function_name, int pos, | 775 const AstRawString* function_name, int pos, |
| 776 const ParserFormalParameters& parameters, FunctionKind kind, | 776 const ParserFormalParameters& parameters, FunctionKind kind, |
| 777 FunctionLiteral::FunctionType function_type, bool* ok); | 777 FunctionLiteral::FunctionType function_type, bool* ok); |
| 778 | 778 |
| 779 void ThrowPendingError(Isolate* isolate, Handle<Script> script); | 779 void ThrowPendingError(Isolate* isolate, Handle<Script> script); |
| 780 | 780 |
| 781 class TemplateLiteral : public ZoneObject { | 781 class TemplateLiteral : public ZoneObject { |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 855 V8_INLINE void RewriteNonPattern(ExpressionClassifier* classifier, bool* ok); | 855 V8_INLINE void RewriteNonPattern(ExpressionClassifier* classifier, bool* ok); |
| 856 | 856 |
| 857 V8_INLINE void QueueDestructuringAssignmentForRewriting( | 857 V8_INLINE void QueueDestructuringAssignmentForRewriting( |
| 858 Expression* assignment); | 858 Expression* assignment); |
| 859 V8_INLINE void QueueNonPatternForRewriting(Expression* expr, bool* ok); | 859 V8_INLINE void QueueNonPatternForRewriting(Expression* expr, bool* ok); |
| 860 | 860 |
| 861 friend class InitializerRewriter; | 861 friend class InitializerRewriter; |
| 862 void RewriteParameterInitializer(Expression* expr, Scope* scope); | 862 void RewriteParameterInitializer(Expression* expr, Scope* scope); |
| 863 | 863 |
| 864 Expression* BuildCreateJSGeneratorObject(int pos, FunctionKind kind); | 864 Expression* BuildCreateJSGeneratorObject(int pos, FunctionKind kind); |
| 865 Expression* BuildPromiseResolve(Expression* value, int pos); | 865 Expression* BuildResolvePromise(Expression* value, int pos); |
| 866 Expression* BuildPromiseReject(Expression* value, int pos); | 866 Expression* BuildRejectPromise(Expression* value, int pos); |
| 867 VariableProxy* BuildDotPromise(); |
| 868 VariableProxy* BuildDebugIsActive(); |
| 867 | 869 |
| 868 // Generic AST generator for throwing errors from compiled code. | 870 // Generic AST generator for throwing errors from compiled code. |
| 869 Expression* NewThrowError(Runtime::FunctionId function_id, | 871 Expression* NewThrowError(Runtime::FunctionId function_id, |
| 870 MessageTemplate::Template message, | 872 MessageTemplate::Template message, |
| 871 const AstRawString* arg, int pos); | 873 const AstRawString* arg, int pos); |
| 872 | 874 |
| 873 void FinalizeIteratorUse(Variable* completion, Expression* condition, | 875 void FinalizeIteratorUse(Variable* completion, Expression* condition, |
| 874 Variable* iter, Block* iterator_use, Block* result); | 876 Variable* iter, Block* iterator_use, Block* result); |
| 875 | 877 |
| 876 Statement* FinalizeForOfStatement(ForOfStatement* loop, Variable* completion, | 878 Statement* FinalizeForOfStatement(ForOfStatement* loop, Variable* completion, |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 993 | 995 |
| 994 void ParserBaseTraits<Parser>::AddParameterInitializationBlock( | 996 void ParserBaseTraits<Parser>::AddParameterInitializationBlock( |
| 995 const ParserFormalParameters& parameters, | 997 const ParserFormalParameters& parameters, |
| 996 ZoneList<v8::internal::Statement*>* body, bool is_async, bool* ok) { | 998 ZoneList<v8::internal::Statement*>* body, bool is_async, bool* ok) { |
| 997 if (!parameters.is_simple) { | 999 if (!parameters.is_simple) { |
| 998 auto* init_block = | 1000 auto* init_block = |
| 999 delegate()->BuildParameterInitializationBlock(parameters, ok); | 1001 delegate()->BuildParameterInitializationBlock(parameters, ok); |
| 1000 if (!*ok) return; | 1002 if (!*ok) return; |
| 1001 | 1003 |
| 1002 if (is_async) { | 1004 if (is_async) { |
| 1003 init_block = delegate()->BuildRejectPromiseOnException(init_block); | 1005 init_block = delegate()->BuildRejectPromiseOnException(init_block, ok); |
| 1006 if (!*ok) return; |
| 1004 } | 1007 } |
| 1005 | 1008 |
| 1006 if (init_block != nullptr) { | 1009 if (init_block != nullptr) { |
| 1007 body->Add(init_block, delegate()->zone()); | 1010 body->Add(init_block, delegate()->zone()); |
| 1008 } | 1011 } |
| 1009 } | 1012 } |
| 1010 } | 1013 } |
| 1011 | 1014 |
| 1012 } // namespace internal | 1015 } // namespace internal |
| 1013 } // namespace v8 | 1016 } // namespace v8 |
| 1014 | 1017 |
| 1015 #endif // V8_PARSING_PARSER_H_ | 1018 #endif // V8_PARSING_PARSER_H_ |
| OLD | NEW |