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

Unified Diff: src/ast/scopes.h

Issue 2345243002: Only create ScopeInfos for eagerly parsed scopes. (Closed)
Patch Set: updates Created 4 years, 3 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 | « no previous file | src/ast/scopes.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ast/scopes.h
diff --git a/src/ast/scopes.h b/src/ast/scopes.h
index 6987b7ffb153e066ae6ccc11f3a88eb56d6ef395..2df27c04188572b92f52c23567fd2e2aac68c31d 100644
--- a/src/ast/scopes.h
+++ b/src/ast/scopes.h
@@ -411,6 +411,10 @@ class Scope: public ZoneObject {
void set_is_debug_evaluate_scope() { is_debug_evaluate_scope_ = true; }
bool is_debug_evaluate_scope() const { return is_debug_evaluate_scope_; }
+ void set_is_lazily_parsed(bool is_lazily_parsed) {
+ is_lazily_parsed_ = is_lazily_parsed;
+ }
+
protected:
explicit Scope(Zone* zone);
@@ -437,6 +441,9 @@ class Scope: public ZoneObject {
// should also be invoked after resolution.
bool NeedsScopeInfo() const {
DCHECK(!already_resolved_);
+ // A lazily parsed scope doesn't contain enough information to create a
+ // ScopeInfo from it.
+ if (is_lazily_parsed_) return false;
return NeedsContext() || is_script_scope() || is_function_scope() ||
is_eval_scope() || is_module_scope();
}
@@ -506,6 +513,8 @@ class Scope: public ZoneObject {
// True if it holds 'var' declarations.
bool is_declaration_scope_ : 1;
+ bool is_lazily_parsed_ : 1;
+
// Create a non-local variable with a given name.
// These variables are looked up dynamically at runtime.
Variable* NonLocal(const AstRawString* name, VariableMode mode);
« no previous file with comments | « no previous file | src/ast/scopes.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698