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

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

Issue 2158913005: Introduce NewScriptScope that creates a top-level scope (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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 881155577801b70d03ca99fe76cb1394409c128c..11416d508da93625d5b1fa9fffa1cf1bd9b3d49a 100644
--- a/src/parsing/parser-base.h
+++ b/src/parsing/parser-base.h
@@ -615,9 +615,16 @@ class ParserBase : public Traits {
Mode old_mode_;
};
+ Scope* NewScriptScope() {
+ return new (zone()) Scope(zone(), nullptr, SCRIPT_SCOPE, kNormalFunction);
+ }
+
Scope* NewScope(Scope* parent, ScopeType scope_type) {
- // Must always pass the function kind for FUNCTION_SCOPE.
- DCHECK(scope_type != FUNCTION_SCOPE);
+ // Must always use the specific constructors for the blacklisted scope
+ // types.
+ DCHECK_NE(FUNCTION_SCOPE, scope_type);
+ DCHECK_NE(SCRIPT_SCOPE, scope_type);
+ DCHECK_NOT_NULL(parent);
Scope* result =
new (zone()) Scope(zone(), parent, scope_type, kNormalFunction);
if (scope_type == MODULE_SCOPE) result->DeclareThis(ast_value_factory());
« 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