Skip to content

Commit c1479a8

Browse files
committed
Codegen: properly handle RustTy::ExtenderReceiver
Signed-off-by: Jan Haller <[email protected]>
1 parent 88b9a9e commit c1479a8

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

godot-codegen/src/generator/default_parameters.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,10 +191,8 @@ fn make_extender_receiver(sig: &dyn Function) -> ExtenderReceiver {
191191
ExtenderReceiver {
192192
object_fn_param: Some(FnParam {
193193
name: ident("surround_object"),
194-
// Not exactly EngineClass, but close enough
195-
type_: RustTy::EngineClass {
194+
type_: RustTy::ExtenderReceiver {
196195
tokens: quote! { &'a #builder_mut re_export::#class },
197-
inner_class: ident("unknown"),
198196
},
199197
default_value: None,
200198
}),

godot-codegen/src/models/domain.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -622,6 +622,9 @@ pub enum RustTy {
622622
#[allow(dead_code)] // only read in minimal config
623623
inner_class: Ident,
624624
},
625+
626+
/// Receiver type of default parameters extender constructor.
627+
ExtenderReceiver { tokens: TokenStream },
625628
}
626629

627630
impl RustTy {
@@ -650,6 +653,7 @@ impl ToTokens for RustTy {
650653
RustTy::EngineEnum { tokens: path, .. } => path.to_tokens(tokens),
651654
RustTy::EngineBitfield { tokens: path, .. } => path.to_tokens(tokens),
652655
RustTy::EngineClass { tokens: path, .. } => path.to_tokens(tokens),
656+
RustTy::ExtenderReceiver { tokens: path } => path.to_tokens(tokens),
653657
}
654658
}
655659
}

godot-codegen/src/special_cases/codegen_special_cases.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ fn is_type_excluded(ty: &str, ctx: &mut Context) -> bool {
5353
Some(class) => is_class_excluded(class.as_str()),
5454
},
5555
RustTy::EngineClass { inner_class, .. } => is_class_excluded(&inner_class.to_string()),
56+
RustTy::ExtenderReceiver { .. } => false,
5657
}
5758
}
5859
is_rust_type_excluded(&conv::to_rust_type(ty, None, ctx))

0 commit comments

Comments
 (0)