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

Unified Diff: src/scopes.cc

Issue 1244423003: [es6] Fix function context check for super and new.target (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Comment; added test for super calls Created 5 years, 5 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/scopes.h ('k') | test/mjsunit/harmony/new-target.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/scopes.cc
diff --git a/src/scopes.cc b/src/scopes.cc
index a044b76baccc4c4b0d330aa0a749b5b022908610..6e1c18dc2e11b346c3c3e4914d58160a8027eb5c 100644
--- a/src/scopes.cc
+++ b/src/scopes.cc
@@ -763,24 +763,26 @@ int Scope::ContextChainLength(Scope* scope) {
}
-Scope* Scope::ScriptScope() {
+Scope* Scope::DeclarationScope() {
Scope* scope = this;
- while (!scope->is_script_scope()) {
+ while (!scope->is_declaration_scope()) {
scope = scope->outer_scope();
}
return scope;
}
-Scope* Scope::DeclarationScope() {
+Scope* Scope::ReceiverScope() {
Scope* scope = this;
- while (!scope->is_declaration_scope()) {
+ while (!scope->is_script_scope() &&
+ (!scope->is_function_scope() || scope->is_arrow_scope())) {
scope = scope->outer_scope();
}
return scope;
}
+
Handle<ScopeInfo> Scope::GetScopeInfo(Isolate* isolate) {
if (scope_info_.is_null()) {
scope_info_ = ScopeInfo::Create(isolate, zone(), this);
« no previous file with comments | « src/scopes.h ('k') | test/mjsunit/harmony/new-target.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698