Index: src/parsing/parser-base.h |
diff --git a/src/parsing/parser-base.h b/src/parsing/parser-base.h |
index 11416d508da93625d5b1fa9fffa1cf1bd9b3d49a..57e37c4fdf6617de73f69ca1c53f498858ec0985 100644 |
--- a/src/parsing/parser-base.h |
+++ b/src/parsing/parser-base.h |
@@ -619,7 +619,14 @@ class ParserBase : public Traits { |
return new (zone()) Scope(zone(), nullptr, SCRIPT_SCOPE, kNormalFunction); |
} |
- Scope* NewScope(Scope* parent, ScopeType scope_type) { |
+ Scope* NewScope(ScopeType scope_type) { |
+ return NewScopeWithParent(scope(), scope_type); |
+ } |
+ |
+ // This constructor should only be used when absolutely necessary. Most scopes |
+ // should automatically use scope() as parent, and be fine with |
+ // NewScope(ScopeType) above. |
+ Scope* NewScopeWithParent(Scope* parent, ScopeType scope_type) { |
// Must always use the specific constructors for the blacklisted scope |
// types. |
DCHECK_NE(FUNCTION_SCOPE, scope_type); |