Index: src/parsing/parser-base.h |
diff --git a/src/parsing/parser-base.h b/src/parsing/parser-base.h |
index 3d486b88857fb003ec07c63f76701d8c97afec29..e438e7112c3ac6bcb394d0e0804c9190678e0e98 100644 |
--- a/src/parsing/parser-base.h |
+++ b/src/parsing/parser-base.h |
@@ -707,10 +707,15 @@ class ParserBase { |
return new (zone()) Scope(zone(), parent, scope_type); |
} |
- DeclarationScope* NewFunctionScope(FunctionKind kind) const { |
+ // Creates a function scope that always allocates in zone(). The function |
+ // scope itself is either allocated in zone() or in target_zone if one is |
+ // passed in. |
+ DeclarationScope* NewFunctionScope(FunctionKind kind, |
+ Zone* target_zone = nullptr) const { |
DCHECK(ast_value_factory()); |
- DeclarationScope* result = |
- new (zone()) DeclarationScope(zone(), scope(), FUNCTION_SCOPE, kind); |
+ if (target_zone == nullptr) target_zone = zone(); |
+ DeclarationScope* result = new (target_zone) |
+ DeclarationScope(zone(), scope(), FUNCTION_SCOPE, kind); |
// TODO(verwaest): Move into the DeclarationScope constructor. |
if (!IsArrowFunction(kind)) { |
result->DeclareDefaultFunctionVariables(ast_value_factory()); |