avm2: Don't use a `Class`'s first `ClassObject` for its VTable if more than one `ClassObject` had been constructed for the class
This commit is contained in:
parent
a763842b1b
commit
4d8c98af0d
|
@ -295,6 +295,14 @@ impl<'gc> Class<'gc> {
|
|||
&self.class_objects
|
||||
}
|
||||
|
||||
pub fn class_object(&self) -> Option<ClassObject<'gc>> {
|
||||
if self.class_objects.len() == 1 {
|
||||
Some(self.class_objects[0])
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
/// Construct a class from a `TranslationUnit` and its class index.
|
||||
///
|
||||
/// The returned class will be allocated, but no traits will be loaded. The
|
||||
|
|
|
@ -38,9 +38,8 @@ impl<'gc> Locals<'gc> {
|
|||
// after the ClassObject refactor
|
||||
self.0[index] = class
|
||||
.read()
|
||||
.class_objects()
|
||||
.get(0)
|
||||
.map(|c| ValueType::Class(*c))
|
||||
.class_object()
|
||||
.map(ValueType::Class)
|
||||
.unwrap_or(ValueType::Any);
|
||||
}
|
||||
|
||||
|
@ -79,9 +78,8 @@ impl<'gc> Stack<'gc> {
|
|||
self.0.push(
|
||||
class
|
||||
.read()
|
||||
.class_objects()
|
||||
.get(0)
|
||||
.map(|c| ValueType::Class(*c))
|
||||
.class_object()
|
||||
.map(ValueType::Class)
|
||||
.unwrap_or(ValueType::Any),
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue