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

Unified Diff: src/ast/scopeinfo.cc

Issue 2353623002: Filter out synthetic variables from with scopes (Closed)
Patch Set: Fix whitespace 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 | « no previous file | src/ast/scopes.h » ('j') | src/ast/scopes.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ast/scopeinfo.cc
diff --git a/src/ast/scopeinfo.cc b/src/ast/scopeinfo.cc
index d3014274d40bf1abdf2cb708fdcde9f0be9bb273..8f4bdb625874f22e9ac98868242a11c6deac22df 100644
--- a/src/ast/scopeinfo.cc
+++ b/src/ast/scopeinfo.cc
@@ -618,6 +618,14 @@ bool ScopeInfo::VariableIsSynthetic(String* name) {
name->Equals(name->GetHeap()->this_string());
}
+bool Scope::VariableIsSynthetic(const AstRawString* name) {
adamk 2016/09/19 20:01:25 Yikes, I think this should be in scopes.cc. If you
+ // There's currently no flag stored on the ScopeInfo to indicate that a
+ // variable is a compiler-introduced temporary. However, to avoid conflict
+ // with user declarations, the current temporaries like .generator_object and
+ // .result start with a dot, so we can use that as a flag. It's a hack!
+ return name->length() == 0 || name->FirstCharacter() == '.' ||
+ name->IsOneByteEqualTo("this");
+}
int ScopeInfo::StackSlotIndex(String* name) {
DCHECK(name->IsInternalizedString());
« no previous file with comments | « no previous file | src/ast/scopes.h » ('j') | src/ast/scopes.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698