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/allocation.h" | 8 #include "src/allocation.h" |
9 #include "src/ast/ast.h" | 9 #include "src/ast/ast.h" |
10 #include "src/ast/scopes.h" | 10 #include "src/ast/scopes.h" |
(...skipping 913 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
924 Block* block_; | 924 Block* block_; |
925 const DeclarationDescriptor* descriptor_; | 925 const DeclarationDescriptor* descriptor_; |
926 ZoneList<const AstRawString*>* names_; | 926 ZoneList<const AstRawString*>* names_; |
927 Expression* current_value_; | 927 Expression* current_value_; |
928 int recursion_level_; | 928 int recursion_level_; |
929 bool* ok_; | 929 bool* ok_; |
930 | 930 |
931 DEFINE_AST_VISITOR_MEMBERS_WITHOUT_STACKOVERFLOW() | 931 DEFINE_AST_VISITOR_MEMBERS_WITHOUT_STACKOVERFLOW() |
932 }; | 932 }; |
933 | 933 |
934 // Helper for putting parts of the parse results into a temporary zone when | |
935 // parsing inner function bodies. | |
936 class DiscardableZoneScope { | |
titzer
2016/07/19 07:55:30
AFAICT the main difference between DiscardableZone
| |
937 public: | |
938 DiscardableZoneScope(Parser* parser, Zone* temp_zone, bool use_temp_zone) | |
939 : ast_node_factory_scope_(parser->factory(), temp_zone, use_temp_zone), | |
940 fni_(parser->ast_value_factory_, temp_zone), | |
941 parser_(parser), | |
942 prev_fni_(parser->fni_) { | |
943 if (use_temp_zone) { | |
944 parser_->fni_ = &fni_; | |
945 } | |
946 } | |
947 ~DiscardableZoneScope() { parser_->fni_ = prev_fni_; } | |
948 | |
949 private: | |
950 AstNodeFactory::BodyScope ast_node_factory_scope_; | |
951 FuncNameInferrer fni_; | |
952 Parser* parser_; | |
953 FuncNameInferrer* prev_fni_; | |
954 }; | |
955 | |
934 Block* ParseVariableDeclarations(VariableDeclarationContext var_context, | 956 Block* ParseVariableDeclarations(VariableDeclarationContext var_context, |
935 DeclarationParsingResult* parsing_result, | 957 DeclarationParsingResult* parsing_result, |
936 ZoneList<const AstRawString*>* names, | 958 ZoneList<const AstRawString*>* names, |
937 bool* ok); | 959 bool* ok); |
938 Statement* ParseExpressionOrLabelledStatement( | 960 Statement* ParseExpressionOrLabelledStatement( |
939 ZoneList<const AstRawString*>* labels, | 961 ZoneList<const AstRawString*>* labels, |
940 AllowLabelledFunctionStatement allow_function, bool* ok); | 962 AllowLabelledFunctionStatement allow_function, bool* ok); |
941 IfStatement* ParseIfStatement(ZoneList<const AstRawString*>* labels, | 963 IfStatement* ParseIfStatement(ZoneList<const AstRawString*>* labels, |
942 bool* ok); | 964 bool* ok); |
943 Statement* ParseContinueStatement(bool* ok); | 965 Statement* ParseContinueStatement(bool* ok); |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1311 | 1333 |
1312 DoExpression* ParserTraits::ParseDoExpression(bool* ok) { | 1334 DoExpression* ParserTraits::ParseDoExpression(bool* ok) { |
1313 return parser_->ParseDoExpression(ok); | 1335 return parser_->ParseDoExpression(ok); |
1314 } | 1336 } |
1315 | 1337 |
1316 | 1338 |
1317 } // namespace internal | 1339 } // namespace internal |
1318 } // namespace v8 | 1340 } // namespace v8 |
1319 | 1341 |
1320 #endif // V8_PARSING_PARSER_H_ | 1342 #endif // V8_PARSING_PARSER_H_ |
OLD | NEW |