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

Unified Diff: src/scopes.cc

Issue 911363002: Revert of new classes: implement new.target passing to superclass constructor. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 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') | src/variables.h » ('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 16d2c111b9a86b179562839e61a32dee928824aa..fa95bde2b2ff0f6062427003850bf94d2af5db8b 100644
--- a/src/scopes.cc
+++ b/src/scopes.cc
@@ -148,7 +148,6 @@
scope_name_ = ast_value_factory_->empty_string();
dynamics_ = NULL;
receiver_ = NULL;
- new_target_ = nullptr;
function_ = NULL;
arguments_ = NULL;
illegal_redecl_ = NULL;
@@ -288,7 +287,7 @@
}
-void Scope::Initialize(bool subclass_constructor) {
+void Scope::Initialize(bool uninitialized_this) {
DCHECK(!already_resolved());
// Add this scope as a new inner scope of the outer scope.
@@ -308,22 +307,14 @@
// such parameter is 'this' which is passed on the stack when
// invoking scripts
if (is_declaration_scope()) {
- DCHECK(!subclass_constructor || is_function_scope());
- DCHECK(FLAG_experimental_classes || !subclass_constructor);
+ DCHECK(!uninitialized_this || is_function_scope());
+ DCHECK(FLAG_experimental_classes || !uninitialized_this);
Variable* var = variables_.Declare(
this, ast_value_factory_->this_string(),
- subclass_constructor ? CONST : VAR, false, Variable::THIS,
- subclass_constructor ? kNeedsInitialization : kCreatedInitialized);
+ uninitialized_this ? CONST : VAR, false, Variable::THIS,
+ uninitialized_this ? kNeedsInitialization : kCreatedInitialized);
var->AllocateTo(Variable::PARAMETER, -1);
receiver_ = var;
-
- if (subclass_constructor) {
- new_target_ = variables_.Declare(
- this, ast_value_factory_->new_target_string(), CONST, false,
- Variable::NEW_TARGET, kCreatedInitialized);
- new_target_->AllocateTo(Variable::PARAMETER, -2);
- new_target_->set_is_used();
- }
} else {
DCHECK(outer_scope() != NULL);
receiver_ = outer_scope()->receiver();
@@ -1210,10 +1201,15 @@
// Give var a read/write use if there is a chance it might be accessed
// via an eval() call. This is only possible if the variable has a
// visible name.
- if ((var->is_this() || var->is_new_target() || !var->raw_name()->IsEmpty()) &&
- (var->has_forced_context_allocation() || scope_calls_eval_ ||
- inner_scope_calls_eval_ || scope_contains_with_ || is_catch_scope() ||
- is_block_scope() || is_module_scope() || is_script_scope())) {
+ if ((var->is_this() || !var->raw_name()->IsEmpty()) &&
+ (var->has_forced_context_allocation() ||
+ scope_calls_eval_ ||
+ inner_scope_calls_eval_ ||
+ scope_contains_with_ ||
+ is_catch_scope() ||
+ is_block_scope() ||
+ is_module_scope() ||
+ is_script_scope())) {
var->set_is_used();
if (scope_calls_eval_ || inner_scope_calls_eval_) var->set_maybe_assigned();
}
« no previous file with comments | « src/scopes.h ('k') | src/variables.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698