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

Unified Diff: src/ast/scopes.cc

Issue 1564343002: Fix for temporaries in parameter initializers (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 11 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/ast/variables.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 21c9e2e373b5408c58fa61b646cbe1d39c3a1e20..c2b05b7c040ca6ed11f700d952a10947fb4e893c 100644
--- a/src/ast/scopes.cc
+++ b/src/ast/scopes.cc
@@ -575,11 +575,24 @@ Variable* Scope::NewTemporary(const AstRawString* name) {
TEMPORARY,
Variable::NORMAL,
kCreatedInitialized);
- scope->temps_.Add(var, zone());
+ scope->AddTemporary(var);
return var;
}
+bool Scope::RemoveTemporary(Variable* var) {
+ // 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;) {
+ if (temps_[i] == var) {
+ temps_.Remove(i);
+ return true;
+ }
+ }
+ return false;
+}
+
+
void Scope::AddDeclaration(Declaration* declaration) {
decls_.Add(declaration, zone());
}
« no previous file with comments | « src/ast/scopes.h ('k') | src/ast/variables.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698