avm2: Pass a `Mutation` to `VTable::init_vtable` instead of an `UpdateContext`

This commit is contained in:
Lord-McSweeney 2024-06-20 18:15:02 -07:00 committed by Lord-McSweeney
parent 343ea346d2
commit 01bdbd20d6
4 changed files with 8 additions and 10 deletions

View File

@ -745,7 +745,7 @@ impl<'gc> Class<'gc> {
&read.traits, &read.traits,
None, None,
read.super_class.map(|c| c.vtable()), read.super_class.map(|c| c.vtable()),
context, context.gc_context,
); );
drop(read); drop(read);

View File

@ -210,7 +210,7 @@ impl<'gc> ClassObject<'gc> {
&class.traits(), &class.traits(),
Some(self.instance_scope()), Some(self.instance_scope()),
self.superclass_object().map(|cls| cls.instance_vtable()), self.superclass_object().map(|cls| cls.instance_vtable()),
&mut activation.context, activation.context.gc_context,
); );
self.link_interfaces(activation)?; self.link_interfaces(activation)?;
@ -253,7 +253,7 @@ impl<'gc> ClassObject<'gc> {
&c_class.traits(), &c_class.traits(),
Some(self.class_scope()), Some(self.class_scope()),
Some(activation.avm2().classes().class.instance_vtable()), Some(activation.avm2().classes().class.instance_vtable()),
&mut activation.context, activation.context.gc_context,
); );
self.set_vtable(activation.context.gc_context, class_vtable); self.set_vtable(activation.context.gc_context, class_vtable);

View File

@ -628,7 +628,6 @@ impl<'gc> Script<'gc> {
write.initialized = true; write.initialized = true;
let globals = write.globals; let globals = write.globals;
let mut null_activation = Activation::from_nothing(context.reborrow());
let domain = write.domain; let domain = write.domain;
drop(write); drop(write);
@ -641,7 +640,7 @@ impl<'gc> Script<'gc> {
&self.traits()?, &self.traits()?,
Some(scope), Some(scope),
None, None,
&mut null_activation.context, context.gc_context,
); );
globals.install_instance_slots(context.gc_context); globals.install_instance_slots(context.gc_context);

View File

@ -8,7 +8,6 @@ use crate::avm2::scope::ScopeChain;
use crate::avm2::traits::{Trait, TraitKind}; use crate::avm2::traits::{Trait, TraitKind};
use crate::avm2::value::Value; use crate::avm2::value::Value;
use crate::avm2::{Class, Error, Multiname, Namespace, QName}; use crate::avm2::{Class, Error, Multiname, Namespace, QName};
use crate::context::UpdateContext;
use crate::string::AvmString; use crate::string::AvmString;
use gc_arena::{Collect, GcCell, Mutation}; use gc_arena::{Collect, GcCell, Mutation};
use std::cell::Ref; use std::cell::Ref;
@ -216,7 +215,7 @@ impl<'gc> VTable<'gc> {
traits: &[Trait<'gc>], traits: &[Trait<'gc>],
scope: Option<ScopeChain<'gc>>, scope: Option<ScopeChain<'gc>>,
superclass_vtable: Option<Self>, superclass_vtable: Option<Self>,
context: &mut UpdateContext<'_, 'gc>, mc: &Mutation<'gc>,
) { ) {
// Let's talk about slot_ids and disp_ids. // Let's talk about slot_ids and disp_ids.
// Specification is one thing, but reality is another. // Specification is one thing, but reality is another.
@ -269,7 +268,7 @@ impl<'gc> VTable<'gc> {
// so long-term it's still something we should verify. // so long-term it's still something we should verify.
// (and it's far from the only verification check we lack anyway) // (and it's far from the only verification check we lack anyway)
let mut write = self.0.write(context.gc_context); let mut write = self.0.write(mc);
let write = write.deref_mut(); let write = write.deref_mut();
write.scope = scope; write.scope = scope;
@ -462,13 +461,13 @@ impl<'gc> VTable<'gc> {
type_name, unit, .. type_name, unit, ..
} => ( } => (
Property::new_slot(new_slot_id), Property::new_slot(new_slot_id),
PropertyClass::name(context.gc_context, type_name.clone(), *unit), PropertyClass::name(mc, type_name.clone(), *unit),
), ),
TraitKind::Const { TraitKind::Const {
type_name, unit, .. type_name, unit, ..
} => ( } => (
Property::new_const_slot(new_slot_id), Property::new_const_slot(new_slot_id),
PropertyClass::name(context.gc_context, type_name.clone(), *unit), PropertyClass::name(mc, type_name.clone(), *unit),
), ),
TraitKind::Class { class, .. } => ( TraitKind::Class { class, .. } => (
Property::new_const_slot(new_slot_id), Property::new_const_slot(new_slot_id),