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

Unified Diff: src/ast/scopes.cc

Issue 2083083007: Fix bug with re-scoping arrow function parameter initializers (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Optimization for closure scopes Created 4 years, 6 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/parsing/parameter-initializer-rewriter.cc » ('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 c7ef42e1b2295442b5be9f26b9a1b5859ca0c532..77c5d628f7ec86ca5de28a318b754d2d80f1d790 100644
--- a/src/ast/scopes.cc
+++ b/src/ast/scopes.cc
@@ -560,6 +560,11 @@ Variable* Scope::NewTemporary(const AstRawString* name) {
int Scope::RemoveTemporary(Variable* var) {
DCHECK_NOT_NULL(var);
+ // Temporaries are only placed in ClosureScopes.
+ DCHECK_EQ(ClosureScope(), this);
+ DCHECK_EQ(var->scope()->ClosureScope(), var->scope());
+ // If the temporary is not here, return quickly.
+ if (var->scope() != this) return -1;
// Most likely (always?) any temporary variable we want to remove
// was just added before, so we search backwards.
for (int i = temps_.length(); i-- > 0;) {
« no previous file with comments | « src/ast/scopes.h ('k') | src/parsing/parameter-initializer-rewriter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698