Commit 646051f9 authored by Sathya Gunasekaran's avatar Sathya Gunasekaran Committed by Commit Bot

[class] Remove unncessary check for private field

A computed property can never be a private field. That's a SyntaxError.

Change the check to a DCHECK.

Bug: v8:5368
Change-Id: I6701b60f3193639f3ccffacda25074d32d5de5b8
Reviewed-on: https://chromium-review.googlesource.com/c/1385267Reviewed-by: 's avatarMythri Alle <mythria@chromium.org>
Commit-Queue: Sathya Gunasekaran <gsathya@chromium.org>
Cr-Commit-Position: refs/heads/master@{#58451}
parent f88d169e
...@@ -1866,8 +1866,6 @@ void BytecodeGenerator::BuildClassLiteral(ClassLiteral* expr, Register name) { ...@@ -1866,8 +1866,6 @@ void BytecodeGenerator::BuildClassLiteral(ClassLiteral* expr, Register name) {
for (int i = 0; i < expr->properties()->length(); i++) { for (int i = 0; i < expr->properties()->length(); i++) {
ClassLiteral::Property* property = expr->properties()->at(i); ClassLiteral::Property* property = expr->properties()->at(i);
if (property->is_computed_name()) { if (property->is_computed_name()) {
DCHECK_IMPLIES(property->kind() == ClassLiteral::Property::FIELD,
!property->is_private());
Register key = register_allocator()->GrowRegisterList(&args); Register key = register_allocator()->GrowRegisterList(&args);
builder()->SetExpressionAsStatementPosition(property->key()); builder()->SetExpressionAsStatementPosition(property->key());
...@@ -1889,8 +1887,8 @@ void BytecodeGenerator::BuildClassLiteral(ClassLiteral* expr, Register name) { ...@@ -1889,8 +1887,8 @@ void BytecodeGenerator::BuildClassLiteral(ClassLiteral* expr, Register name) {
.Bind(&done); .Bind(&done);
} }
if (property->kind() == ClassLiteral::Property::FIELD && if (property->kind() == ClassLiteral::Property::FIELD) {
!property->is_private()) { DCHECK(!property->is_private());
// Initialize field's name variable with the computed name. // Initialize field's name variable with the computed name.
DCHECK_NOT_NULL(property->computed_name_var()); DCHECK_NOT_NULL(property->computed_name_var());
builder()->LoadAccumulatorWithRegister(key); builder()->LoadAccumulatorWithRegister(key);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment