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

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: Fix test according to reviews 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
Index: src/ast/scopes.cc
diff --git a/src/ast/scopes.cc b/src/ast/scopes.cc
index beffa53d74a971a1e39c02e8eb6dd5224b4c21f8..589e37ce9f54979d2428f84b6c4c88083d7dcd62 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;) {

Powered by Google App Engine
This is Rietveld 408576698