From 97b2cc441372a1200258023f782f1a7d5565cdc6 Mon Sep 17 00:00:00 2001 From: Selimaj Dev Date: Thu, 28 May 2026 16:21:36 +0200 Subject: [PATCH] Working inheritance --- crates/codegen/src/top_level.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/crates/codegen/src/top_level.rs b/crates/codegen/src/top_level.rs index 585de9c..871155e 100644 --- a/crates/codegen/src/top_level.rs +++ b/crates/codegen/src/top_level.rs @@ -339,6 +339,12 @@ impl GenRust for TopLevelKind { )); cg.indent += 1; + if let Some(inherits) = inherits { + cg.add_indented("pub _super: "); + cg.add(&inherits.get_rust()); + cg.addln(","); + } + for field in fields.clone() { cg.add_indentedln(&field.get_comment()); cg.add_indentedln(&field.item.decl.get_rust()); @@ -421,7 +427,9 @@ impl GenRust for TopLevelKind { cg.addln(" {"); cg.indent += 1; - cg.add_indentedln("fn deref(&mut self) -> &mut Self::Target {&mut self._super}"); + cg.add_indentedln( + "fn deref_mut(&mut self) -> &mut Self::Target {&mut self._super}", + ); cg.indent -= 1; cg.addln("}");