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

Unified Diff: src/contexts.cc

Issue 1136883006: Reapply "Resolve references to "this" the same way as normal variables"" (Closed) Base URL: https://chromium.googlesource.com/v8/v8@master
Patch Set: Fix this reference in super call, fix "this" in debug evaluator Created 5 years, 7 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/compiler/ast-graph-builder.cc ('k') | src/heap/heap.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/contexts.cc
diff --git a/src/contexts.cc b/src/contexts.cc
index a6a61df624a49c9460806a96fee5b166ba65efcd..12eb871e15ddbe5eb9acb67acb4485fcec01c258 100644
--- a/src/contexts.cc
+++ b/src/contexts.cc
@@ -258,8 +258,13 @@ Handle<Object> Context::Lookup(Handle<String> name,
object->IsJSContextExtensionObject()) {
maybe = JSReceiver::GetOwnPropertyAttributes(object, name);
} else if (context->IsWithContext()) {
- LookupIterator it(object, name);
- maybe = UnscopableLookup(&it);
+ // A with context will never bind "this".
+ if (name->Equals(*isolate->factory()->this_string())) {
+ maybe = Just(ABSENT);
+ } else {
+ LookupIterator it(object, name);
+ maybe = UnscopableLookup(&it);
+ }
} else {
maybe = JSReceiver::GetPropertyAttributes(object, name);
}
« no previous file with comments | « src/compiler/ast-graph-builder.cc ('k') | src/heap/heap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698