@@ -12,7 +12,6 @@ use quote::{format_ident, ToTokens};
1212
1313use crate :: generator:: method_tables:: MethodTableKey ;
1414use crate :: generator:: notifications;
15- use crate :: generator:: sys:: SYS_PARAMS ;
1615use crate :: models:: domain:: { ArgPassing , GodotTy , RustTy , TyName } ;
1716use crate :: models:: json:: {
1817 JsonBuiltinClass , JsonBuiltinMethod , JsonClass , JsonClassConstant , JsonClassMethod ,
@@ -29,9 +28,6 @@ pub struct Context<'a> {
2928 /// Which interface traits are generated (`false` for "Godot-abstract"/final classes).
3029 classes_final : HashMap < TyName , bool > ,
3130 cached_rust_types : HashMap < GodotTy , RustTy > ,
32- /// Various pointers defined in `gdextension_interface`, for example `GDExtensionInitializationFunction`.
33- /// Used in some APIs that are not exposed to GDScript.
34- sys_types : HashSet < & ' a str > ,
3531 notifications_by_class : HashMap < TyName , Vec < ( Ident , i32 ) > > ,
3632 classes_with_signals : HashSet < TyName > ,
3733 notification_enum_names_by_class : HashMap < TyName , NotificationEnum > ,
@@ -47,8 +43,6 @@ impl<'a> Context<'a> {
4743 ctx. singletons . insert ( class. name . as_str ( ) ) ;
4844 }
4945
50- Self :: populate_sys_types ( & mut ctx) ;
51-
5246 ctx. builtin_types . insert ( "Variant" ) ; // not part of builtin_classes
5347 for builtin in api. builtin_classes . iter ( ) {
5448 let ty_name = builtin. name . as_str ( ) ;
@@ -158,14 +152,6 @@ impl<'a> Context<'a> {
158152 ctx
159153 }
160154
161- /// Adds Godot pointer types to [`Context`].
162- ///
163- /// Godot pointer types, for example `GDExtensionInitializationFunction`, are defined in `gdextension_interface`
164- /// but aren't described in `extension_api.json` – despite being used as parameters in various APIs.
165- fn populate_sys_types ( ctx : & mut Context ) {
166- ctx. sys_types . extend ( SYS_PARAMS . iter ( ) . map ( |p| p. type_ ( ) ) ) ;
167- }
168-
169155 fn populate_notification_constants (
170156 class_name : & TyName ,
171157 constants : & [ JsonClassConstant ] ,
@@ -266,6 +252,14 @@ impl<'a> Context<'a> {
266252 . unwrap_or_else ( || panic ! ( "did not register table index for key {key:?}" ) )
267253 }
268254
255+ /// Yields cached sys pointer types – various pointer types declared in `gdextension_interface`
256+ /// and used as parameters in exposed Godot APIs.
257+ pub fn cached_sys_pointer_types ( & self ) -> impl Iterator < Item = & RustTy > {
258+ self . cached_rust_types
259+ . values ( )
260+ . filter ( |rust_ty| rust_ty. is_sys_pointer ( ) )
261+ }
262+
269263 /// Whether an interface trait is generated for a class.
270264 ///
271265 /// False if the class is "Godot-abstract"/final, thus there are no virtual functions to inherit.
@@ -307,10 +301,6 @@ impl<'a> Context<'a> {
307301 self . native_structures_types . contains ( ty_name)
308302 }
309303
310- pub fn is_sys ( & self , ty_name : & str ) -> bool {
311- self . sys_types . contains ( ty_name)
312- }
313-
314304 pub fn is_singleton ( & self , class_name : & TyName ) -> bool {
315305 self . singletons . contains ( class_name. godot_ty . as_str ( ) )
316306 }
0 commit comments