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

Unified Diff: src/scopeinfo.cc

Issue 1097283003: Resolve references to "this" the same way as normal variables (Closed) Base URL: https://chromium.googlesource.com/v8/v8@master
Patch Set: Statically resolve "this" even inside "with" Created 5 years, 8 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/runtime/runtime-scopes.cc ('k') | src/scopes.h » ('j') | src/scopes.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/scopeinfo.cc
diff --git a/src/scopeinfo.cc b/src/scopeinfo.cc
index 012744992fe783fa072249be7f7454de7699e7ca..4b079b990363fdf63eaccf755c45abf7fae33b5c 100644
--- a/src/scopeinfo.cc
+++ b/src/scopeinfo.cc
@@ -317,7 +317,8 @@ bool ScopeInfo::LocalIsSynthetic(int var) {
// 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!
Handle<String> name(LocalName(var));
- return name->length() > 0 && name->Get(0) == '.';
+ return (name->length() > 0 && name->Get(0) == '.') ||
+ name->Equals(*GetIsolate()->factory()->this_string());
arv (Not doing code reviews) 2015/04/28 14:26:18 Another option would be to use the string ".this"
wingo 2015/04/28 15:07:42 Hah, you're right :) We could actually use any st
}
« no previous file with comments | « src/runtime/runtime-scopes.cc ('k') | src/scopes.h » ('j') | src/scopes.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698