Free functions always have a `prototype`, this is a holdover from ES3.
This commit is contained in:
parent
0e89cb2175
commit
00186f7602
|
@ -1313,13 +1313,21 @@ impl<'gc> Avm2<'gc> {
|
|||
let method_entry = self.table_method(index)?;
|
||||
let scope = self.current_stack_frame().unwrap().read().scope();
|
||||
|
||||
let new_fn = FunctionObject::from_abc_method(
|
||||
let mut new_fn = FunctionObject::from_abc_method(
|
||||
context.gc_context,
|
||||
method_entry,
|
||||
scope,
|
||||
self.system_prototypes.function,
|
||||
None,
|
||||
);
|
||||
let es3_proto = ScriptObject::object(context.gc_context, self.prototypes().object);
|
||||
|
||||
new_fn.install_slot(
|
||||
context.gc_context,
|
||||
QName::new(Namespace::public_namespace(), "prototype"),
|
||||
0,
|
||||
es3_proto.into(),
|
||||
);
|
||||
|
||||
self.push(new_fn);
|
||||
|
||||
|
|
|
@ -508,13 +508,21 @@ pub trait TObject<'gc>: 'gc + Collect + Debug + Into<Object<'gc>> + Clone + Copy
|
|||
slot_id, function, ..
|
||||
} => {
|
||||
let method = Avm2MethodEntry::from_method_index(abc, function.clone()).unwrap();
|
||||
let function = FunctionObject::from_abc_method(
|
||||
let mut function = FunctionObject::from_abc_method(
|
||||
context.gc_context,
|
||||
method,
|
||||
scope,
|
||||
fn_proto,
|
||||
None,
|
||||
);
|
||||
let es3_proto = ScriptObject::object(context.gc_context, avm.prototypes().object);
|
||||
|
||||
function.install_slot(
|
||||
context.gc_context,
|
||||
QName::new(Namespace::public_namespace(), "prototype"),
|
||||
0,
|
||||
es3_proto.into(),
|
||||
);
|
||||
self.install_const(context.gc_context, trait_name, *slot_id, function.into());
|
||||
}
|
||||
AbcTraitKind::Const { slot_id, value, .. } => {
|
||||
|
|
Loading…
Reference in New Issue