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

Unified Diff: src/scopes.cc

Issue 1203813002: [es6] Make new.target work in functions (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Cleanup Created 5 years, 6 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
Index: src/scopes.cc
diff --git a/src/scopes.cc b/src/scopes.cc
index 61a75ab16fcf408a0ba79355f4e43d59979564c8..2ca3446c8051ffd2648160f2607f425a7a0dc0b2 100644
--- a/src/scopes.cc
+++ b/src/scopes.cc
@@ -319,24 +319,20 @@ void Scope::Initialize() {
receiver_ = var;
}
- if (is_function_scope()) {
- if (!is_arrow_scope()) {
- // Declare 'arguments' variable which exists in all non arrow functions.
- // Note that it might never be accessed, in which case it won't be
- // allocated during variable allocation.
- variables_.Declare(this, ast_value_factory_->arguments_string(), VAR,
- Variable::ARGUMENTS, kCreatedInitialized);
- }
-
- if (subclass_constructor) {
- DCHECK(!is_arrow_scope());
+ if (is_function_scope() && !is_arrow_scope()) {
+ // Declare 'arguments' variable which exists in all non arrow functions.
+ // Note that it might never be accessed, in which case it won't be
+ // allocated during variable allocation.
+ variables_.Declare(this, ast_value_factory_->arguments_string(), VAR,
+ Variable::ARGUMENTS, kCreatedInitialized);
+
+ if (subclass_constructor || FLAG_harmony_new_target) {
variables_.Declare(this, ast_value_factory_->new_target_string(), CONST,
Variable::NORMAL, kCreatedInitialized);
}
if (IsConciseMethod(function_kind_) || IsConstructor(function_kind_) ||
IsAccessorFunction(function_kind_)) {
- DCHECK(!is_arrow_scope());
variables_.Declare(this, ast_value_factory_->this_function_string(),
CONST, Variable::NORMAL, kCreatedInitialized);
}

Powered by Google App Engine
This is Rietveld 408576698