|
|
@ -1,4 +1,4 @@ |
|
|
|
use super::{ByteCompiler, Literal, NodeKind}; |
|
|
|
use super::{ByteCompiler, Literal}; |
|
|
|
use crate::vm::{BindingOpcode, Opcode}; |
|
|
|
use crate::vm::{BindingOpcode, Opcode}; |
|
|
|
use boa_ast::{ |
|
|
|
use boa_ast::{ |
|
|
|
expression::Identifier, |
|
|
|
expression::Identifier, |
|
|
@ -108,79 +108,79 @@ impl ByteCompiler<'_, '_> { |
|
|
|
match method_definition { |
|
|
|
match method_definition { |
|
|
|
MethodDefinition::Get(expr) => match name { |
|
|
|
MethodDefinition::Get(expr) => match name { |
|
|
|
PropertyName::Literal(name) => { |
|
|
|
PropertyName::Literal(name) => { |
|
|
|
self.method(expr.into(), NodeKind::Expression, class_name, true); |
|
|
|
self.method(expr.into(), class_name); |
|
|
|
let index = self.get_or_insert_name((*name).into()); |
|
|
|
let index = self.get_or_insert_name((*name).into()); |
|
|
|
self.emit(Opcode::DefineClassStaticGetterByName, &[index]); |
|
|
|
self.emit(Opcode::DefineClassStaticGetterByName, &[index]); |
|
|
|
} |
|
|
|
} |
|
|
|
PropertyName::Computed(name_node) => { |
|
|
|
PropertyName::Computed(name_node) => { |
|
|
|
self.compile_expr(name_node, true); |
|
|
|
self.compile_expr(name_node, true); |
|
|
|
self.emit_opcode(Opcode::ToPropertyKey); |
|
|
|
self.emit_opcode(Opcode::ToPropertyKey); |
|
|
|
self.method(expr.into(), NodeKind::Expression, class_name, true); |
|
|
|
self.method(expr.into(), class_name); |
|
|
|
self.emit_opcode(Opcode::DefineClassStaticGetterByValue); |
|
|
|
self.emit_opcode(Opcode::DefineClassStaticGetterByValue); |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
MethodDefinition::Set(expr) => match name { |
|
|
|
MethodDefinition::Set(expr) => match name { |
|
|
|
PropertyName::Literal(name) => { |
|
|
|
PropertyName::Literal(name) => { |
|
|
|
self.method(expr.into(), NodeKind::Expression, class_name, true); |
|
|
|
self.method(expr.into(), class_name); |
|
|
|
let index = self.get_or_insert_name((*name).into()); |
|
|
|
let index = self.get_or_insert_name((*name).into()); |
|
|
|
self.emit(Opcode::DefineClassStaticSetterByName, &[index]); |
|
|
|
self.emit(Opcode::DefineClassStaticSetterByName, &[index]); |
|
|
|
} |
|
|
|
} |
|
|
|
PropertyName::Computed(name_node) => { |
|
|
|
PropertyName::Computed(name_node) => { |
|
|
|
self.compile_expr(name_node, true); |
|
|
|
self.compile_expr(name_node, true); |
|
|
|
self.emit_opcode(Opcode::ToPropertyKey); |
|
|
|
self.emit_opcode(Opcode::ToPropertyKey); |
|
|
|
self.method(expr.into(), NodeKind::Expression, class_name, true); |
|
|
|
self.method(expr.into(), class_name); |
|
|
|
self.emit_opcode(Opcode::DefineClassStaticSetterByValue); |
|
|
|
self.emit_opcode(Opcode::DefineClassStaticSetterByValue); |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
MethodDefinition::Ordinary(expr) => match name { |
|
|
|
MethodDefinition::Ordinary(expr) => match name { |
|
|
|
PropertyName::Literal(name) => { |
|
|
|
PropertyName::Literal(name) => { |
|
|
|
self.method(expr.into(), NodeKind::Expression, class_name, true); |
|
|
|
self.method(expr.into(), class_name); |
|
|
|
let index = self.get_or_insert_name((*name).into()); |
|
|
|
let index = self.get_or_insert_name((*name).into()); |
|
|
|
self.emit(Opcode::DefineClassStaticMethodByName, &[index]); |
|
|
|
self.emit(Opcode::DefineClassStaticMethodByName, &[index]); |
|
|
|
} |
|
|
|
} |
|
|
|
PropertyName::Computed(name_node) => { |
|
|
|
PropertyName::Computed(name_node) => { |
|
|
|
self.compile_expr(name_node, true); |
|
|
|
self.compile_expr(name_node, true); |
|
|
|
self.emit_opcode(Opcode::ToPropertyKey); |
|
|
|
self.emit_opcode(Opcode::ToPropertyKey); |
|
|
|
self.method(expr.into(), NodeKind::Expression, class_name, true); |
|
|
|
self.method(expr.into(), class_name); |
|
|
|
self.emit_opcode(Opcode::DefineClassStaticMethodByValue); |
|
|
|
self.emit_opcode(Opcode::DefineClassStaticMethodByValue); |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
MethodDefinition::Async(expr) => match name { |
|
|
|
MethodDefinition::Async(expr) => match name { |
|
|
|
PropertyName::Literal(name) => { |
|
|
|
PropertyName::Literal(name) => { |
|
|
|
self.method(expr.into(), NodeKind::Expression, class_name, true); |
|
|
|
self.method(expr.into(), class_name); |
|
|
|
let index = self.get_or_insert_name((*name).into()); |
|
|
|
let index = self.get_or_insert_name((*name).into()); |
|
|
|
self.emit(Opcode::DefineClassStaticMethodByName, &[index]); |
|
|
|
self.emit(Opcode::DefineClassStaticMethodByName, &[index]); |
|
|
|
} |
|
|
|
} |
|
|
|
PropertyName::Computed(name_node) => { |
|
|
|
PropertyName::Computed(name_node) => { |
|
|
|
self.compile_expr(name_node, true); |
|
|
|
self.compile_expr(name_node, true); |
|
|
|
self.emit_opcode(Opcode::ToPropertyKey); |
|
|
|
self.emit_opcode(Opcode::ToPropertyKey); |
|
|
|
self.method(expr.into(), NodeKind::Expression, class_name, true); |
|
|
|
self.method(expr.into(), class_name); |
|
|
|
self.emit_opcode(Opcode::DefineClassStaticMethodByValue); |
|
|
|
self.emit_opcode(Opcode::DefineClassStaticMethodByValue); |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
MethodDefinition::Generator(expr) => match name { |
|
|
|
MethodDefinition::Generator(expr) => match name { |
|
|
|
PropertyName::Literal(name) => { |
|
|
|
PropertyName::Literal(name) => { |
|
|
|
self.method(expr.into(), NodeKind::Expression, class_name, true); |
|
|
|
self.method(expr.into(), class_name); |
|
|
|
let index = self.get_or_insert_name((*name).into()); |
|
|
|
let index = self.get_or_insert_name((*name).into()); |
|
|
|
self.emit(Opcode::DefineClassStaticMethodByName, &[index]); |
|
|
|
self.emit(Opcode::DefineClassStaticMethodByName, &[index]); |
|
|
|
} |
|
|
|
} |
|
|
|
PropertyName::Computed(name_node) => { |
|
|
|
PropertyName::Computed(name_node) => { |
|
|
|
self.compile_expr(name_node, true); |
|
|
|
self.compile_expr(name_node, true); |
|
|
|
self.emit_opcode(Opcode::ToPropertyKey); |
|
|
|
self.emit_opcode(Opcode::ToPropertyKey); |
|
|
|
self.method(expr.into(), NodeKind::Expression, class_name, true); |
|
|
|
self.method(expr.into(), class_name); |
|
|
|
self.emit_opcode(Opcode::DefineClassStaticMethodByValue); |
|
|
|
self.emit_opcode(Opcode::DefineClassStaticMethodByValue); |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
MethodDefinition::AsyncGenerator(expr) => match name { |
|
|
|
MethodDefinition::AsyncGenerator(expr) => match name { |
|
|
|
PropertyName::Literal(name) => { |
|
|
|
PropertyName::Literal(name) => { |
|
|
|
self.method(expr.into(), NodeKind::Expression, class_name, true); |
|
|
|
self.method(expr.into(), class_name); |
|
|
|
let index = self.get_or_insert_name((*name).into()); |
|
|
|
let index = self.get_or_insert_name((*name).into()); |
|
|
|
self.emit(Opcode::DefineClassStaticMethodByName, &[index]); |
|
|
|
self.emit(Opcode::DefineClassStaticMethodByName, &[index]); |
|
|
|
} |
|
|
|
} |
|
|
|
PropertyName::Computed(name_node) => { |
|
|
|
PropertyName::Computed(name_node) => { |
|
|
|
self.compile_expr(name_node, true); |
|
|
|
self.compile_expr(name_node, true); |
|
|
|
self.emit_opcode(Opcode::ToPropertyKey); |
|
|
|
self.emit_opcode(Opcode::ToPropertyKey); |
|
|
|
self.method(expr.into(), NodeKind::Expression, class_name, true); |
|
|
|
self.method(expr.into(), class_name); |
|
|
|
self.emit_opcode(Opcode::DefineClassStaticMethodByValue); |
|
|
|
self.emit_opcode(Opcode::DefineClassStaticMethodByValue); |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
@ -191,32 +191,32 @@ impl ByteCompiler<'_, '_> { |
|
|
|
self.emit_opcode(Opcode::Dup); |
|
|
|
self.emit_opcode(Opcode::Dup); |
|
|
|
match method_definition { |
|
|
|
match method_definition { |
|
|
|
MethodDefinition::Get(expr) => { |
|
|
|
MethodDefinition::Get(expr) => { |
|
|
|
self.method(expr.into(), NodeKind::Expression, class_name, true); |
|
|
|
self.method(expr.into(), class_name); |
|
|
|
let index = self.get_or_insert_private_name(*name); |
|
|
|
let index = self.get_or_insert_private_name(*name); |
|
|
|
self.emit(Opcode::SetPrivateGetter, &[index]); |
|
|
|
self.emit(Opcode::SetPrivateGetter, &[index]); |
|
|
|
} |
|
|
|
} |
|
|
|
MethodDefinition::Set(expr) => { |
|
|
|
MethodDefinition::Set(expr) => { |
|
|
|
self.method(expr.into(), NodeKind::Expression, class_name, true); |
|
|
|
self.method(expr.into(), class_name); |
|
|
|
let index = self.get_or_insert_private_name(*name); |
|
|
|
let index = self.get_or_insert_private_name(*name); |
|
|
|
self.emit(Opcode::SetPrivateSetter, &[index]); |
|
|
|
self.emit(Opcode::SetPrivateSetter, &[index]); |
|
|
|
} |
|
|
|
} |
|
|
|
MethodDefinition::Ordinary(expr) => { |
|
|
|
MethodDefinition::Ordinary(expr) => { |
|
|
|
self.method(expr.into(), NodeKind::Expression, class_name, true); |
|
|
|
self.method(expr.into(), class_name); |
|
|
|
let index = self.get_or_insert_private_name(*name); |
|
|
|
let index = self.get_or_insert_private_name(*name); |
|
|
|
self.emit(Opcode::SetPrivateMethod, &[index]); |
|
|
|
self.emit(Opcode::SetPrivateMethod, &[index]); |
|
|
|
} |
|
|
|
} |
|
|
|
MethodDefinition::Async(expr) => { |
|
|
|
MethodDefinition::Async(expr) => { |
|
|
|
self.method(expr.into(), NodeKind::Expression, class_name, true); |
|
|
|
self.method(expr.into(), class_name); |
|
|
|
let index = self.get_or_insert_private_name(*name); |
|
|
|
let index = self.get_or_insert_private_name(*name); |
|
|
|
self.emit(Opcode::SetPrivateMethod, &[index]); |
|
|
|
self.emit(Opcode::SetPrivateMethod, &[index]); |
|
|
|
} |
|
|
|
} |
|
|
|
MethodDefinition::Generator(expr) => { |
|
|
|
MethodDefinition::Generator(expr) => { |
|
|
|
self.method(expr.into(), NodeKind::Expression, class_name, true); |
|
|
|
self.method(expr.into(), class_name); |
|
|
|
let index = self.get_or_insert_private_name(*name); |
|
|
|
let index = self.get_or_insert_private_name(*name); |
|
|
|
self.emit(Opcode::SetPrivateMethod, &[index]); |
|
|
|
self.emit(Opcode::SetPrivateMethod, &[index]); |
|
|
|
} |
|
|
|
} |
|
|
|
MethodDefinition::AsyncGenerator(expr) => { |
|
|
|
MethodDefinition::AsyncGenerator(expr) => { |
|
|
|
self.method(expr.into(), NodeKind::Expression, class_name, true); |
|
|
|
self.method(expr.into(), class_name); |
|
|
|
let index = self.get_or_insert_private_name(*name); |
|
|
|
let index = self.get_or_insert_private_name(*name); |
|
|
|
self.emit(Opcode::SetPrivateMethod, &[index]); |
|
|
|
self.emit(Opcode::SetPrivateMethod, &[index]); |
|
|
|
} |
|
|
|
} |
|
|
@ -393,32 +393,32 @@ impl ByteCompiler<'_, '_> { |
|
|
|
self.emit_opcode(Opcode::Dup); |
|
|
|
self.emit_opcode(Opcode::Dup); |
|
|
|
match method_definition { |
|
|
|
match method_definition { |
|
|
|
MethodDefinition::Get(expr) => { |
|
|
|
MethodDefinition::Get(expr) => { |
|
|
|
self.method(expr.into(), NodeKind::Expression, class_name, true); |
|
|
|
self.method(expr.into(), class_name); |
|
|
|
let index = self.get_or_insert_private_name(*name); |
|
|
|
let index = self.get_or_insert_private_name(*name); |
|
|
|
self.emit(Opcode::PushClassPrivateGetter, &[index]); |
|
|
|
self.emit(Opcode::PushClassPrivateGetter, &[index]); |
|
|
|
} |
|
|
|
} |
|
|
|
MethodDefinition::Set(expr) => { |
|
|
|
MethodDefinition::Set(expr) => { |
|
|
|
self.method(expr.into(), NodeKind::Expression, class_name, true); |
|
|
|
self.method(expr.into(), class_name); |
|
|
|
let index = self.get_or_insert_private_name(*name); |
|
|
|
let index = self.get_or_insert_private_name(*name); |
|
|
|
self.emit(Opcode::PushClassPrivateSetter, &[index]); |
|
|
|
self.emit(Opcode::PushClassPrivateSetter, &[index]); |
|
|
|
} |
|
|
|
} |
|
|
|
MethodDefinition::Ordinary(expr) => { |
|
|
|
MethodDefinition::Ordinary(expr) => { |
|
|
|
self.method(expr.into(), NodeKind::Expression, class_name, true); |
|
|
|
self.method(expr.into(), class_name); |
|
|
|
let index = self.get_or_insert_private_name(*name); |
|
|
|
let index = self.get_or_insert_private_name(*name); |
|
|
|
self.emit(Opcode::PushClassPrivateMethod, &[index]); |
|
|
|
self.emit(Opcode::PushClassPrivateMethod, &[index]); |
|
|
|
} |
|
|
|
} |
|
|
|
MethodDefinition::Async(expr) => { |
|
|
|
MethodDefinition::Async(expr) => { |
|
|
|
self.method(expr.into(), NodeKind::Expression, class_name, true); |
|
|
|
self.method(expr.into(), class_name); |
|
|
|
let index = self.get_or_insert_private_name(*name); |
|
|
|
let index = self.get_or_insert_private_name(*name); |
|
|
|
self.emit(Opcode::PushClassPrivateMethod, &[index]); |
|
|
|
self.emit(Opcode::PushClassPrivateMethod, &[index]); |
|
|
|
} |
|
|
|
} |
|
|
|
MethodDefinition::Generator(expr) => { |
|
|
|
MethodDefinition::Generator(expr) => { |
|
|
|
self.method(expr.into(), NodeKind::Expression, class_name, true); |
|
|
|
self.method(expr.into(), class_name); |
|
|
|
let index = self.get_or_insert_private_name(*name); |
|
|
|
let index = self.get_or_insert_private_name(*name); |
|
|
|
self.emit(Opcode::PushClassPrivateMethod, &[index]); |
|
|
|
self.emit(Opcode::PushClassPrivateMethod, &[index]); |
|
|
|
} |
|
|
|
} |
|
|
|
MethodDefinition::AsyncGenerator(expr) => { |
|
|
|
MethodDefinition::AsyncGenerator(expr) => { |
|
|
|
self.method(expr.into(), NodeKind::Expression, class_name, true); |
|
|
|
self.method(expr.into(), class_name); |
|
|
|
let index = self.get_or_insert_private_name(*name); |
|
|
|
let index = self.get_or_insert_private_name(*name); |
|
|
|
self.emit(Opcode::PushClassPrivateMethod, &[index]); |
|
|
|
self.emit(Opcode::PushClassPrivateMethod, &[index]); |
|
|
|
} |
|
|
|
} |
|
|
@ -438,79 +438,79 @@ impl ByteCompiler<'_, '_> { |
|
|
|
match method_definition { |
|
|
|
match method_definition { |
|
|
|
MethodDefinition::Get(expr) => match name { |
|
|
|
MethodDefinition::Get(expr) => match name { |
|
|
|
PropertyName::Literal(name) => { |
|
|
|
PropertyName::Literal(name) => { |
|
|
|
self.method(expr.into(), NodeKind::Expression, class_name, true); |
|
|
|
self.method(expr.into(), class_name); |
|
|
|
let index = self.get_or_insert_name((*name).into()); |
|
|
|
let index = self.get_or_insert_name((*name).into()); |
|
|
|
self.emit(Opcode::DefineClassGetterByName, &[index]); |
|
|
|
self.emit(Opcode::DefineClassGetterByName, &[index]); |
|
|
|
} |
|
|
|
} |
|
|
|
PropertyName::Computed(name_node) => { |
|
|
|
PropertyName::Computed(name_node) => { |
|
|
|
self.compile_expr(name_node, true); |
|
|
|
self.compile_expr(name_node, true); |
|
|
|
self.emit_opcode(Opcode::ToPropertyKey); |
|
|
|
self.emit_opcode(Opcode::ToPropertyKey); |
|
|
|
self.method(expr.into(), NodeKind::Expression, class_name, true); |
|
|
|
self.method(expr.into(), class_name); |
|
|
|
self.emit_opcode(Opcode::DefineClassGetterByValue); |
|
|
|
self.emit_opcode(Opcode::DefineClassGetterByValue); |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
MethodDefinition::Set(expr) => match name { |
|
|
|
MethodDefinition::Set(expr) => match name { |
|
|
|
PropertyName::Literal(name) => { |
|
|
|
PropertyName::Literal(name) => { |
|
|
|
self.method(expr.into(), NodeKind::Expression, class_name, true); |
|
|
|
self.method(expr.into(), class_name); |
|
|
|
let index = self.get_or_insert_name((*name).into()); |
|
|
|
let index = self.get_or_insert_name((*name).into()); |
|
|
|
self.emit(Opcode::DefineClassSetterByName, &[index]); |
|
|
|
self.emit(Opcode::DefineClassSetterByName, &[index]); |
|
|
|
} |
|
|
|
} |
|
|
|
PropertyName::Computed(name_node) => { |
|
|
|
PropertyName::Computed(name_node) => { |
|
|
|
self.compile_expr(name_node, true); |
|
|
|
self.compile_expr(name_node, true); |
|
|
|
self.emit_opcode(Opcode::ToPropertyKey); |
|
|
|
self.emit_opcode(Opcode::ToPropertyKey); |
|
|
|
self.method(expr.into(), NodeKind::Expression, class_name, true); |
|
|
|
self.method(expr.into(), class_name); |
|
|
|
self.emit_opcode(Opcode::DefineClassSetterByValue); |
|
|
|
self.emit_opcode(Opcode::DefineClassSetterByValue); |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
MethodDefinition::Ordinary(expr) => match name { |
|
|
|
MethodDefinition::Ordinary(expr) => match name { |
|
|
|
PropertyName::Literal(name) => { |
|
|
|
PropertyName::Literal(name) => { |
|
|
|
self.method(expr.into(), NodeKind::Expression, class_name, true); |
|
|
|
self.method(expr.into(), class_name); |
|
|
|
let index = self.get_or_insert_name((*name).into()); |
|
|
|
let index = self.get_or_insert_name((*name).into()); |
|
|
|
self.emit(Opcode::DefineClassMethodByName, &[index]); |
|
|
|
self.emit(Opcode::DefineClassMethodByName, &[index]); |
|
|
|
} |
|
|
|
} |
|
|
|
PropertyName::Computed(name_node) => { |
|
|
|
PropertyName::Computed(name_node) => { |
|
|
|
self.compile_expr(name_node, true); |
|
|
|
self.compile_expr(name_node, true); |
|
|
|
self.emit_opcode(Opcode::ToPropertyKey); |
|
|
|
self.emit_opcode(Opcode::ToPropertyKey); |
|
|
|
self.method(expr.into(), NodeKind::Expression, class_name, true); |
|
|
|
self.method(expr.into(), class_name); |
|
|
|
self.emit_opcode(Opcode::DefineClassMethodByValue); |
|
|
|
self.emit_opcode(Opcode::DefineClassMethodByValue); |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
MethodDefinition::Async(expr) => match name { |
|
|
|
MethodDefinition::Async(expr) => match name { |
|
|
|
PropertyName::Literal(name) => { |
|
|
|
PropertyName::Literal(name) => { |
|
|
|
self.method(expr.into(), NodeKind::Expression, class_name, true); |
|
|
|
self.method(expr.into(), class_name); |
|
|
|
let index = self.get_or_insert_name((*name).into()); |
|
|
|
let index = self.get_or_insert_name((*name).into()); |
|
|
|
self.emit(Opcode::DefineClassMethodByName, &[index]); |
|
|
|
self.emit(Opcode::DefineClassMethodByName, &[index]); |
|
|
|
} |
|
|
|
} |
|
|
|
PropertyName::Computed(name_node) => { |
|
|
|
PropertyName::Computed(name_node) => { |
|
|
|
self.compile_expr(name_node, true); |
|
|
|
self.compile_expr(name_node, true); |
|
|
|
self.emit_opcode(Opcode::ToPropertyKey); |
|
|
|
self.emit_opcode(Opcode::ToPropertyKey); |
|
|
|
self.method(expr.into(), NodeKind::Expression, class_name, true); |
|
|
|
self.method(expr.into(), class_name); |
|
|
|
self.emit_opcode(Opcode::DefineClassMethodByValue); |
|
|
|
self.emit_opcode(Opcode::DefineClassMethodByValue); |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
MethodDefinition::Generator(expr) => match name { |
|
|
|
MethodDefinition::Generator(expr) => match name { |
|
|
|
PropertyName::Literal(name) => { |
|
|
|
PropertyName::Literal(name) => { |
|
|
|
self.method(expr.into(), NodeKind::Expression, class_name, true); |
|
|
|
self.method(expr.into(), class_name); |
|
|
|
let index = self.get_or_insert_name((*name).into()); |
|
|
|
let index = self.get_or_insert_name((*name).into()); |
|
|
|
self.emit(Opcode::DefineClassMethodByName, &[index]); |
|
|
|
self.emit(Opcode::DefineClassMethodByName, &[index]); |
|
|
|
} |
|
|
|
} |
|
|
|
PropertyName::Computed(name_node) => { |
|
|
|
PropertyName::Computed(name_node) => { |
|
|
|
self.compile_expr(name_node, true); |
|
|
|
self.compile_expr(name_node, true); |
|
|
|
self.emit_opcode(Opcode::ToPropertyKey); |
|
|
|
self.emit_opcode(Opcode::ToPropertyKey); |
|
|
|
self.method(expr.into(), NodeKind::Expression, class_name, true); |
|
|
|
self.method(expr.into(), class_name); |
|
|
|
self.emit_opcode(Opcode::DefineClassMethodByValue); |
|
|
|
self.emit_opcode(Opcode::DefineClassMethodByValue); |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
MethodDefinition::AsyncGenerator(expr) => match name { |
|
|
|
MethodDefinition::AsyncGenerator(expr) => match name { |
|
|
|
PropertyName::Literal(name) => { |
|
|
|
PropertyName::Literal(name) => { |
|
|
|
self.method(expr.into(), NodeKind::Expression, class_name, true); |
|
|
|
self.method(expr.into(), class_name); |
|
|
|
let index = self.get_or_insert_name((*name).into()); |
|
|
|
let index = self.get_or_insert_name((*name).into()); |
|
|
|
self.emit(Opcode::DefineClassMethodByName, &[index]); |
|
|
|
self.emit(Opcode::DefineClassMethodByName, &[index]); |
|
|
|
} |
|
|
|
} |
|
|
|
PropertyName::Computed(name_node) => { |
|
|
|
PropertyName::Computed(name_node) => { |
|
|
|
self.compile_expr(name_node, true); |
|
|
|
self.compile_expr(name_node, true); |
|
|
|
self.emit_opcode(Opcode::ToPropertyKey); |
|
|
|
self.emit_opcode(Opcode::ToPropertyKey); |
|
|
|
self.method(expr.into(), NodeKind::Expression, class_name, true); |
|
|
|
self.method(expr.into(), class_name); |
|
|
|
self.emit_opcode(Opcode::DefineClassMethodByValue); |
|
|
|
self.emit_opcode(Opcode::DefineClassMethodByValue); |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|