Chromium Code Reviews| Index: src/parsing/parser.h |
| diff --git a/src/parsing/parser.h b/src/parsing/parser.h |
| index 76611dfae55bdc4fe6e92aa2fc2c06b574d5f983..1e2022d1ecc83d062a7306d5f3ee8d047c255320 100644 |
| --- a/src/parsing/parser.h |
| +++ b/src/parsing/parser.h |
| @@ -931,6 +931,28 @@ class Parser : public ParserBase<ParserTraits> { |
| DEFINE_AST_VISITOR_MEMBERS_WITHOUT_STACKOVERFLOW() |
| }; |
| + // Helper for putting parts of the parse results into a temporary zone when |
| + // parsing inner function bodies. |
| + class DiscardableZoneScope { |
|
titzer
2016/07/19 07:55:30
AFAICT the main difference between DiscardableZone
|
| + public: |
| + DiscardableZoneScope(Parser* parser, Zone* temp_zone, bool use_temp_zone) |
| + : ast_node_factory_scope_(parser->factory(), temp_zone, use_temp_zone), |
| + fni_(parser->ast_value_factory_, temp_zone), |
| + parser_(parser), |
| + prev_fni_(parser->fni_) { |
| + if (use_temp_zone) { |
| + parser_->fni_ = &fni_; |
| + } |
| + } |
| + ~DiscardableZoneScope() { parser_->fni_ = prev_fni_; } |
| + |
| + private: |
| + AstNodeFactory::BodyScope ast_node_factory_scope_; |
| + FuncNameInferrer fni_; |
| + Parser* parser_; |
| + FuncNameInferrer* prev_fni_; |
| + }; |
| + |
| Block* ParseVariableDeclarations(VariableDeclarationContext var_context, |
| DeclarationParsingResult* parsing_result, |
| ZoneList<const AstRawString*>* names, |