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

Unified Diff: src/ast/scopes.cc

Issue 2302013002: Store the scope info in catch contexts (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 | « src/ast/scopes.h ('k') | src/compiler/access-builder.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ast/scopes.cc
diff --git a/src/ast/scopes.cc b/src/ast/scopes.cc
index beb572114451214ef6ee12a4ddbb54347e78c314..3e3779c3cfeba7ac16b0b93687ecb29c5a36e34a 100644
--- a/src/ast/scopes.cc
+++ b/src/ast/scopes.cc
@@ -223,17 +223,22 @@ DeclarationScope::DeclarationScope(Zone* zone, ScopeType scope_type,
SetDefaults();
}
-Scope::Scope(Zone* zone, const AstRawString* catch_variable_name)
+Scope::Scope(Zone* zone, const AstRawString* catch_variable_name,
+ Handle<ScopeInfo> scope_info)
: zone_(zone),
outer_scope_(nullptr),
variables_(zone),
locals_(0, zone),
decls_(0, zone),
+ scope_info_(scope_info),
scope_type_(CATCH_SCOPE) {
SetDefaults();
#ifdef DEBUG
already_resolved_ = true;
#endif
+ // Cache the catch variable, even though it's also available via the
+ // scope_info, as the parser expects that a catch scope always has the catch
+ // variable as first and only variable.
Variable* variable = Declare(zone, this, catch_variable_name, VAR,
Variable::NORMAL, kCreatedInitialized);
AllocateHeapSlot(variable);
@@ -367,7 +372,8 @@ Scope* Scope::DeserializeScopeChain(Isolate* isolate, Zone* zone,
DCHECK(context->IsCatchContext());
String* name = context->catch_name();
outer_scope = new (zone)
- Scope(zone, ast_value_factory->GetString(handle(name, isolate)));
+ Scope(zone, ast_value_factory->GetString(handle(name, isolate)),
+ Handle<ScopeInfo>(context->scope_info()));
}
if (current_scope != nullptr) {
outer_scope->AddInnerScope(current_scope);
« no previous file with comments | « src/ast/scopes.h ('k') | src/compiler/access-builder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698