From 1977bd59be97f12a413bd94654b4229d832a518e Mon Sep 17 00:00:00 2001 From: Klesti Selimaj Date: Sun, 7 Jun 2026 01:32:00 +0200 Subject: [PATCH] VTable update --- crates/codegen/src/class_decl.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/crates/codegen/src/class_decl.rs b/crates/codegen/src/class_decl.rs index 9dae552..27e86d3 100644 --- a/crates/codegen/src/class_decl.rs +++ b/crates/codegen/src/class_decl.rs @@ -137,7 +137,7 @@ pub fn class_decl( cg.add_indentedln("#[allow(invalid_value)]"); cg.add_indentedln(&constructor_comment); - (fields, constructor).gen_rust(ctx, cg); + (fields, constructor, inherits.is_some()).gen_rust(ctx, cg); for mut method in methods { match method.item.visibility { @@ -200,7 +200,13 @@ pub fn class_decl( } } -impl GenRust for (&Vec>, &Spanned) { +impl GenRust + for ( + &Vec>, + &Spanned, + bool, + ) +{ fn gen_rust(&self, ctx: &mut Context, cg: &mut RustCodegen) { cg.add_indented(&format!( "{}fn new{}(", @@ -264,6 +270,10 @@ impl GenRust for (&Vec>, &Spanned) { cg.addln(");"); + if self.2 { + cg.add("this._super._m_oop.0 = &Self::__SUPER_V_TABLE as *const *const std::ffi::c_void;"); + } + cg.add_indentedln("this"); cg.indent -= 1;