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

Unified Diff: src/runtime/runtime-debug.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: Add tests for "this" scoping in arrow functions 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/parser.cc ('k') | src/runtime/runtime-scopes.cc » ('j') | src/scopes.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime/runtime-debug.cc
diff --git a/src/runtime/runtime-debug.cc b/src/runtime/runtime-debug.cc
index 736d33dadce30cdfcc9571eb4b50dc13d6ad3c73..391b4839a27a050cba7b629a2d0b40a289a11fec 100644
--- a/src/runtime/runtime-debug.cc
+++ b/src/runtime/runtime-debug.cc
@@ -1268,16 +1268,21 @@ class ScopeIterator {
context_ = Handle<Context>();
return;
}
- if (scope_type == ScopeTypeScript) seen_script_scope_ = true;
- if (nested_scope_chain_.is_empty()) {
- if (scope_type == ScopeTypeScript) {
- if (context_->IsScriptContext()) {
- context_ = Handle<Context>(context_->previous(), isolate_);
- }
- CHECK(context_->IsNativeContext());
- } else {
+ if (scope_type == ScopeTypeScript) {
+ seen_script_scope_ = true;
+ if (context_->IsScriptContext()) {
context_ = Handle<Context>(context_->previous(), isolate_);
}
+ if (!nested_scope_chain_.is_empty()) {
+ DCHECK_EQ(nested_scope_chain_.last()->scope_type(), SCRIPT_SCOPE);
+ nested_scope_chain_.RemoveLast();
+ DCHECK(nested_scope_chain_.is_empty());
+ }
+ CHECK(context_->IsNativeContext());
+ return;
+ }
+ if (nested_scope_chain_.is_empty()) {
+ context_ = Handle<Context>(context_->previous(), isolate_);
} else {
if (nested_scope_chain_.last()->HasContext()) {
DCHECK(context_->previous() != NULL);
« no previous file with comments | « src/parser.cc ('k') | src/runtime/runtime-scopes.cc » ('j') | src/scopes.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698