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
|
&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.
|
/// Construct a class from a `TranslationUnit` and its class index.
|
||||||
///
|
///
|
||||||
/// The returned class will be allocated, but no traits will be loaded. The
|
/// 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
|
// after the ClassObject refactor
|
||||||
self.0[index] = class
|
self.0[index] = class
|
||||||
.read()
|
.read()
|
||||||
.class_objects()
|
.class_object()
|
||||||
.get(0)
|
.map(ValueType::Class)
|
||||||
.map(|c| ValueType::Class(*c))
|
|
||||||
.unwrap_or(ValueType::Any);
|
.unwrap_or(ValueType::Any);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,9 +78,8 @@ impl<'gc> Stack<'gc> {
|
||||||
self.0.push(
|
self.0.push(
|
||||||
class
|
class
|
||||||
.read()
|
.read()
|
||||||
.class_objects()
|
.class_object()
|
||||||
.get(0)
|
.map(ValueType::Class)
|
||||||
.map(|c| ValueType::Class(*c))
|
|
||||||
.unwrap_or(ValueType::Any),
|
.unwrap_or(ValueType::Any),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue