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

Unified Diff: src/ast/scopes.cc

Issue 2693313002: [ast] Mark temporaries as maybe-assigned by default. (Closed)
Patch Set: Make the powerful variant private. Created 3 years, 10 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/parser.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 f24eed3d3331b5a93392794c7d64c5624ff75bab..2bc9b3af64ad656c2719475fd98d800ec13492c1 100644
--- a/src/ast/scopes.cc
+++ b/src/ast/scopes.cc
@@ -708,7 +708,8 @@ Variable* DeclarationScope::DeclareGeneratorObjectVar(
DCHECK(is_function_scope() || is_module_scope());
DCHECK_NULL(generator_object_var());
- Variable* result = EnsureRareData()->generator_object = NewTemporary(name);
+ Variable* result = EnsureRareData()->generator_object =
+ NewTemporary(name, kNotAssigned);
result->set_is_used();
return result;
}
@@ -1205,10 +1206,16 @@ bool Scope::RemoveUnresolved(VariableProxy* var) {
}
Variable* Scope::NewTemporary(const AstRawString* name) {
+ return NewTemporary(name, kMaybeAssigned);
+}
+
+Variable* Scope::NewTemporary(const AstRawString* name,
+ MaybeAssignedFlag maybe_assigned) {
DeclarationScope* scope = GetClosureScope();
Variable* var = new (zone())
Variable(scope, name, TEMPORARY, NORMAL_VARIABLE, kCreatedInitialized);
scope->AddLocal(var);
+ if (maybe_assigned == kMaybeAssigned) var->set_maybe_assigned();
return var;
}
« no previous file with comments | « src/ast/scopes.h ('k') | src/parsing/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698