| Index: src/full-codegen/full-codegen.cc
|
| diff --git a/src/full-codegen/full-codegen.cc b/src/full-codegen/full-codegen.cc
|
| index 6182094e821933230802568745df22e03b9b5872..a5134d9ae06d31d0e94389bc285585250d0cd0af 100644
|
| --- a/src/full-codegen/full-codegen.cc
|
| +++ b/src/full-codegen/full-codegen.cc
|
| @@ -1528,6 +1528,20 @@ void FullCodeGenerator::VisitClassLiteral(ClassLiteral* lit) {
|
| PrepareForBailoutForId(lit->CreateLiteralId(), BailoutState::TOS_REGISTER);
|
| PushOperand(result_register());
|
|
|
| + // The below proxy exists to allow static field initializers to have the
|
| + // correct home object and receiver. It's only necessary if the initializers
|
| + // are called as a part of class definition instead of immediately after it,
|
| + // in which case they could simply refer to the class just constructed. The
|
| + // latter is actually what's currently specified, and this will need to be
|
| + // changed if that behavior is settled upon. See also
|
| + // https://github.com/tc39/proposal-class-public-fields/issues/50
|
| + VariableProxy* static_initializer_proxy = lit->static_initializer_proxy();
|
| + if (static_initializer_proxy != nullptr) {
|
| + Variable* variable = static_initializer_proxy->var();
|
| + EmitVariableAssignment(variable, Token::INIT,
|
| + FeedbackVectorSlot::Invalid());
|
| + }
|
| +
|
| // Load the "prototype" from the constructor.
|
| __ Move(LoadDescriptor::ReceiverRegister(), result_register());
|
| __ LoadRoot(LoadDescriptor::NameRegister(), Heap::kprototype_stringRootIndex);
|
|
|