Skip to content

Commit 6dd8def

Browse files
Lord-McSweeneyLord-McSweeney
authored andcommitted
avm2: Simplify uses of GcCell<'gc, Class<'gc>>
1 parent 15c076f commit 6dd8def

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+548
-596
lines changed

core/src/avm2/activation.rs

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ use crate::avm2::{Avm2, Error};
2424
use crate::context::{GcContext, UpdateContext};
2525
use crate::string::{AvmAtom, AvmString};
2626
use crate::tag_utils::SwfMovie;
27-
use gc_arena::{Gc, GcCell};
27+
use gc_arena::Gc;
2828
use smallvec::SmallVec;
2929
use std::cmp::{min, Ordering};
3030
use std::sync::Arc;
@@ -779,7 +779,7 @@ impl<'a, 'gc> Activation<'a, 'gc> {
779779
&mut self,
780780
method: Gc<'gc, BytecodeMethod<'gc>>,
781781
index: Index<AbcClass>,
782-
) -> Result<GcCell<'gc, Class<'gc>>, Error<'gc>> {
782+
) -> Result<Class<'gc>, Error<'gc>> {
783783
method.translation_unit().load_class(index.0, self)
784784
}
785785

@@ -1723,7 +1723,6 @@ impl<'a, 'gc> Activation<'a, 'gc> {
17231723
.instance_of()
17241724
.map(|cls| {
17251725
cls.inner_class_definition()
1726-
.read()
17271726
.name()
17281727
.to_qualified_name_err_message(self.context.gc_context)
17291728
})
@@ -2620,10 +2619,7 @@ impl<'a, 'gc> Activation<'a, 'gc> {
26202619
Ok(FrameControl::Continue)
26212620
}
26222621

2623-
fn op_is_type(
2624-
&mut self,
2625-
class: GcCell<'gc, Class<'gc>>,
2626-
) -> Result<FrameControl<'gc>, Error<'gc>> {
2622+
fn op_is_type(&mut self, class: Class<'gc>) -> Result<FrameControl<'gc>, Error<'gc>> {
26272623
let value = self.pop_stack();
26282624

26292625
let is_instance_of = value.is_of_type(self, class);
@@ -2652,10 +2648,7 @@ impl<'a, 'gc> Activation<'a, 'gc> {
26522648
Ok(FrameControl::Continue)
26532649
}
26542650

2655-
fn op_as_type(
2656-
&mut self,
2657-
class: GcCell<'gc, Class<'gc>>,
2658-
) -> Result<FrameControl<'gc>, Error<'gc>> {
2651+
fn op_as_type(&mut self, class: Class<'gc>) -> Result<FrameControl<'gc>, Error<'gc>> {
26592652
let value = self.pop_stack();
26602653

26612654
if value.is_of_type(self, class) {
@@ -2821,10 +2814,7 @@ impl<'a, 'gc> Activation<'a, 'gc> {
28212814
}
28222815

28232816
/// Implements `Op::Coerce`
2824-
fn op_coerce(
2825-
&mut self,
2826-
class: GcCell<'gc, Class<'gc>>,
2827-
) -> Result<FrameControl<'gc>, Error<'gc>> {
2817+
fn op_coerce(&mut self, class: Class<'gc>) -> Result<FrameControl<'gc>, Error<'gc>> {
28282818
let val = self.pop_stack();
28292819
let x = val.coerce_to_type(self, class)?;
28302820

core/src/avm2/amf.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ pub fn serialize_value<'gc>(
130130
let name = class_to_alias(activation, class);
131131

132132
let mut attributes = EnumSet::empty();
133-
if !class.inner_class_definition().read().is_sealed() {
133+
if !class.inner_class_definition().is_sealed() {
134134
attributes.insert(Attribute::Dynamic);
135135
}
136136

0 commit comments

Comments
 (0)