|
|
@ -46,7 +46,7 @@ impl ByteCompiler<'_, '_> { |
|
|
|
PropertyDefinition::MethodDefinition(name, kind) => match kind { |
|
|
|
PropertyDefinition::MethodDefinition(name, kind) => match kind { |
|
|
|
MethodDefinition::Get(expr) => match name { |
|
|
|
MethodDefinition::Get(expr) => match name { |
|
|
|
PropertyName::Literal(name) => { |
|
|
|
PropertyName::Literal(name) => { |
|
|
|
self.function(expr.into(), NodeKind::Expression, true); |
|
|
|
self.object_method(expr.into(), NodeKind::Expression, true); |
|
|
|
let index = self.get_or_insert_name((*name).into()); |
|
|
|
let index = self.get_or_insert_name((*name).into()); |
|
|
|
self.emit(Opcode::SetPropertyGetterByName, &[index]); |
|
|
|
self.emit(Opcode::SetPropertyGetterByName, &[index]); |
|
|
|
} |
|
|
|
} |
|
|
@ -54,7 +54,7 @@ impl ByteCompiler<'_, '_> { |
|
|
|
self.compile_expr(name_node, true); |
|
|
|
self.compile_expr(name_node, true); |
|
|
|
self.emit_opcode(Opcode::ToPropertyKey); |
|
|
|
self.emit_opcode(Opcode::ToPropertyKey); |
|
|
|
self.emit_opcode(Opcode::Dup); |
|
|
|
self.emit_opcode(Opcode::Dup); |
|
|
|
self.function(expr.into(), NodeKind::Expression, true); |
|
|
|
self.object_method(expr.into(), NodeKind::Expression, true); |
|
|
|
self.emit_opcode(Opcode::SetFunctionName); |
|
|
|
self.emit_opcode(Opcode::SetFunctionName); |
|
|
|
self.emit_u8(1); |
|
|
|
self.emit_u8(1); |
|
|
|
self.emit_opcode(Opcode::SetPropertyGetterByValue); |
|
|
|
self.emit_opcode(Opcode::SetPropertyGetterByValue); |
|
|
@ -62,7 +62,7 @@ impl ByteCompiler<'_, '_> { |
|
|
|
}, |
|
|
|
}, |
|
|
|
MethodDefinition::Set(expr) => match name { |
|
|
|
MethodDefinition::Set(expr) => match name { |
|
|
|
PropertyName::Literal(name) => { |
|
|
|
PropertyName::Literal(name) => { |
|
|
|
self.function(expr.into(), NodeKind::Expression, true); |
|
|
|
self.object_method(expr.into(), NodeKind::Expression, true); |
|
|
|
let index = self.get_or_insert_name((*name).into()); |
|
|
|
let index = self.get_or_insert_name((*name).into()); |
|
|
|
self.emit(Opcode::SetPropertySetterByName, &[index]); |
|
|
|
self.emit(Opcode::SetPropertySetterByName, &[index]); |
|
|
|
} |
|
|
|
} |
|
|
@ -70,7 +70,7 @@ impl ByteCompiler<'_, '_> { |
|
|
|
self.compile_expr(name_node, true); |
|
|
|
self.compile_expr(name_node, true); |
|
|
|
self.emit_opcode(Opcode::ToPropertyKey); |
|
|
|
self.emit_opcode(Opcode::ToPropertyKey); |
|
|
|
self.emit_opcode(Opcode::Dup); |
|
|
|
self.emit_opcode(Opcode::Dup); |
|
|
|
self.function(expr.into(), NodeKind::Expression, true); |
|
|
|
self.object_method(expr.into(), NodeKind::Expression, true); |
|
|
|
self.emit_opcode(Opcode::SetFunctionName); |
|
|
|
self.emit_opcode(Opcode::SetFunctionName); |
|
|
|
self.emit_u8(2); |
|
|
|
self.emit_u8(2); |
|
|
|
self.emit_opcode(Opcode::SetPropertySetterByValue); |
|
|
|
self.emit_opcode(Opcode::SetPropertySetterByValue); |
|
|
@ -78,7 +78,7 @@ impl ByteCompiler<'_, '_> { |
|
|
|
}, |
|
|
|
}, |
|
|
|
MethodDefinition::Ordinary(expr) => match name { |
|
|
|
MethodDefinition::Ordinary(expr) => match name { |
|
|
|
PropertyName::Literal(name) => { |
|
|
|
PropertyName::Literal(name) => { |
|
|
|
self.function(expr.into(), NodeKind::Expression, true); |
|
|
|
self.object_method(expr.into(), NodeKind::Expression, true); |
|
|
|
let index = self.get_or_insert_name((*name).into()); |
|
|
|
let index = self.get_or_insert_name((*name).into()); |
|
|
|
self.emit(Opcode::DefineOwnPropertyByName, &[index]); |
|
|
|
self.emit(Opcode::DefineOwnPropertyByName, &[index]); |
|
|
|
} |
|
|
|
} |
|
|
@ -86,7 +86,7 @@ impl ByteCompiler<'_, '_> { |
|
|
|
self.compile_expr(name_node, true); |
|
|
|
self.compile_expr(name_node, true); |
|
|
|
self.emit_opcode(Opcode::ToPropertyKey); |
|
|
|
self.emit_opcode(Opcode::ToPropertyKey); |
|
|
|
self.emit_opcode(Opcode::Dup); |
|
|
|
self.emit_opcode(Opcode::Dup); |
|
|
|
self.function(expr.into(), NodeKind::Expression, true); |
|
|
|
self.object_method(expr.into(), NodeKind::Expression, true); |
|
|
|
self.emit_opcode(Opcode::SetFunctionName); |
|
|
|
self.emit_opcode(Opcode::SetFunctionName); |
|
|
|
self.emit_u8(0); |
|
|
|
self.emit_u8(0); |
|
|
|
self.emit_opcode(Opcode::DefineOwnPropertyByValue); |
|
|
|
self.emit_opcode(Opcode::DefineOwnPropertyByValue); |
|
|
@ -94,7 +94,7 @@ impl ByteCompiler<'_, '_> { |
|
|
|
}, |
|
|
|
}, |
|
|
|
MethodDefinition::Async(expr) => match name { |
|
|
|
MethodDefinition::Async(expr) => match name { |
|
|
|
PropertyName::Literal(name) => { |
|
|
|
PropertyName::Literal(name) => { |
|
|
|
self.function(expr.into(), NodeKind::Expression, true); |
|
|
|
self.object_method(expr.into(), NodeKind::Expression, true); |
|
|
|
let index = self.get_or_insert_name((*name).into()); |
|
|
|
let index = self.get_or_insert_name((*name).into()); |
|
|
|
self.emit(Opcode::DefineOwnPropertyByName, &[index]); |
|
|
|
self.emit(Opcode::DefineOwnPropertyByName, &[index]); |
|
|
|
} |
|
|
|
} |
|
|
@ -102,7 +102,7 @@ impl ByteCompiler<'_, '_> { |
|
|
|
self.compile_expr(name_node, true); |
|
|
|
self.compile_expr(name_node, true); |
|
|
|
self.emit_opcode(Opcode::ToPropertyKey); |
|
|
|
self.emit_opcode(Opcode::ToPropertyKey); |
|
|
|
self.emit_opcode(Opcode::Dup); |
|
|
|
self.emit_opcode(Opcode::Dup); |
|
|
|
self.function(expr.into(), NodeKind::Expression, true); |
|
|
|
self.object_method(expr.into(), NodeKind::Expression, true); |
|
|
|
self.emit_opcode(Opcode::SetFunctionName); |
|
|
|
self.emit_opcode(Opcode::SetFunctionName); |
|
|
|
self.emit_u8(0); |
|
|
|
self.emit_u8(0); |
|
|
|
self.emit_opcode(Opcode::DefineOwnPropertyByValue); |
|
|
|
self.emit_opcode(Opcode::DefineOwnPropertyByValue); |
|
|
@ -110,7 +110,7 @@ impl ByteCompiler<'_, '_> { |
|
|
|
}, |
|
|
|
}, |
|
|
|
MethodDefinition::Generator(expr) => match name { |
|
|
|
MethodDefinition::Generator(expr) => match name { |
|
|
|
PropertyName::Literal(name) => { |
|
|
|
PropertyName::Literal(name) => { |
|
|
|
self.function(expr.into(), NodeKind::Expression, true); |
|
|
|
self.object_method(expr.into(), NodeKind::Expression, true); |
|
|
|
let index = self.get_or_insert_name((*name).into()); |
|
|
|
let index = self.get_or_insert_name((*name).into()); |
|
|
|
self.emit(Opcode::DefineOwnPropertyByName, &[index]); |
|
|
|
self.emit(Opcode::DefineOwnPropertyByName, &[index]); |
|
|
|
} |
|
|
|
} |
|
|
@ -118,7 +118,7 @@ impl ByteCompiler<'_, '_> { |
|
|
|
self.compile_expr(name_node, true); |
|
|
|
self.compile_expr(name_node, true); |
|
|
|
self.emit_opcode(Opcode::ToPropertyKey); |
|
|
|
self.emit_opcode(Opcode::ToPropertyKey); |
|
|
|
self.emit_opcode(Opcode::Dup); |
|
|
|
self.emit_opcode(Opcode::Dup); |
|
|
|
self.function(expr.into(), NodeKind::Expression, true); |
|
|
|
self.object_method(expr.into(), NodeKind::Expression, true); |
|
|
|
self.emit_opcode(Opcode::SetFunctionName); |
|
|
|
self.emit_opcode(Opcode::SetFunctionName); |
|
|
|
self.emit_u8(0); |
|
|
|
self.emit_u8(0); |
|
|
|
self.emit_opcode(Opcode::DefineOwnPropertyByValue); |
|
|
|
self.emit_opcode(Opcode::DefineOwnPropertyByValue); |
|
|
@ -126,7 +126,7 @@ impl ByteCompiler<'_, '_> { |
|
|
|
}, |
|
|
|
}, |
|
|
|
MethodDefinition::AsyncGenerator(expr) => match name { |
|
|
|
MethodDefinition::AsyncGenerator(expr) => match name { |
|
|
|
PropertyName::Literal(name) => { |
|
|
|
PropertyName::Literal(name) => { |
|
|
|
self.function(expr.into(), NodeKind::Expression, true); |
|
|
|
self.object_method(expr.into(), NodeKind::Expression, true); |
|
|
|
let index = self.get_or_insert_name((*name).into()); |
|
|
|
let index = self.get_or_insert_name((*name).into()); |
|
|
|
self.emit(Opcode::DefineOwnPropertyByName, &[index]); |
|
|
|
self.emit(Opcode::DefineOwnPropertyByName, &[index]); |
|
|
|
} |
|
|
|
} |
|
|
@ -134,7 +134,7 @@ impl ByteCompiler<'_, '_> { |
|
|
|
self.compile_expr(name_node, true); |
|
|
|
self.compile_expr(name_node, true); |
|
|
|
self.emit_opcode(Opcode::ToPropertyKey); |
|
|
|
self.emit_opcode(Opcode::ToPropertyKey); |
|
|
|
self.emit_opcode(Opcode::Dup); |
|
|
|
self.emit_opcode(Opcode::Dup); |
|
|
|
self.function(expr.into(), NodeKind::Expression, true); |
|
|
|
self.object_method(expr.into(), NodeKind::Expression, true); |
|
|
|
self.emit_opcode(Opcode::SetFunctionName); |
|
|
|
self.emit_opcode(Opcode::SetFunctionName); |
|
|
|
self.emit_u8(0); |
|
|
|
self.emit_u8(0); |
|
|
|
self.emit_opcode(Opcode::DefineOwnPropertyByValue); |
|
|
|
self.emit_opcode(Opcode::DefineOwnPropertyByValue); |
|
|
|