Working override target
This commit is contained in:
@@ -231,9 +231,7 @@ impl ClassProcessedData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn emit_super_v_tests(&self, cg: &mut RustCodegen) {
|
fn emit_super_v_tests(&self, cg: &mut RustCodegen) {
|
||||||
for (idx, (override_tier, _)) in
|
for (idx, (override_tier, _)) in self.override_v_table.iter().enumerate() {
|
||||||
self.override_v_table.iter().enumerate()
|
|
||||||
{
|
|
||||||
// Resolve the target path for this specific sub-table
|
// Resolve the target path for this specific sub-table
|
||||||
let target_path = match &override_tier.0 {
|
let target_path = match &override_tier.0 {
|
||||||
// Override(Some(path)) / Override::Path(path) -> Targets deep ancestor
|
// Override(Some(path)) / Override::Path(path) -> Targets deep ancestor
|
||||||
@@ -380,7 +378,7 @@ impl ClassProcessedData {
|
|||||||
// Deep ancestor trait table updates
|
// Deep ancestor trait table updates
|
||||||
Some(path) => {
|
Some(path) => {
|
||||||
cg.add_indentedln(&format!(
|
cg.add_indentedln(&format!(
|
||||||
"<{} as std::ops::Deref>::deref(&this)._m_oop.0 = Self::__SUPER_V_TABLES[{}];",
|
"(|v: &mut {}| {{v._m_oop.0 = Self::__SUPER_V_TABLES[{}];}})(&mut this);",
|
||||||
path.get_rust(),
|
path.get_rust(),
|
||||||
idx
|
idx
|
||||||
));
|
));
|
||||||
|
|||||||
@@ -15,7 +15,15 @@ pub class Animal<T> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub class Dog : Animal<i32> {
|
pub class Mammal : Animal<i32> {
|
||||||
|
constructor() {
|
||||||
|
unsafe {
|
||||||
|
std::ptr::write(&mut super, Super::new());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub class Dog : Mammal {
|
||||||
constructor() {
|
constructor() {
|
||||||
unsafe {
|
unsafe {
|
||||||
std::ptr::write(&mut super, Super::new());
|
std::ptr::write(&mut super, Super::new());
|
||||||
|
|||||||
Reference in New Issue
Block a user