Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(311)

Unified Diff: src/parsing/parser-base.h

Issue 2164943002: Split NewScope into NewScope and NewScopeWithParent (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressed comment Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/parsing/parser.cc ('k') | src/parsing/preparser.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « src/parsing/parser.cc ('k') | src/parsing/preparser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698