@@ -9,7 +9,7 @@ use crate::context::Context;
99use crate :: generator:: builtins;
1010use crate :: models:: domain:: { ExtensionApi , ModName , NativeStructure , TyName } ;
1111use crate :: util:: ident;
12- use crate :: { conv, util, SubmitFn } ;
12+ use crate :: { conv, special_cases , util, SubmitFn } ;
1313use proc_macro2:: TokenStream ;
1414use quote:: { format_ident, quote} ;
1515use std:: path:: Path ;
@@ -25,6 +25,11 @@ pub fn generate_native_structures_files(
2525
2626 let mut modules = vec ! [ ] ;
2727 for native_structure in api. native_structures . iter ( ) {
28+ // Some may be excluded in minimal codegen, because they hold codegen-excluded classes as fields.
29+ if special_cases:: is_native_struct_excluded ( & native_structure. name ) {
30+ continue ;
31+ }
32+
2833 let module_name = ModName :: from_godot ( & native_structure. name ) ;
2934 let class_name = TyName :: from_godot ( & native_structure. name ) ;
3035
@@ -232,10 +237,11 @@ fn make_native_structure_field_and_accessor(
232237 ( field_def, accessor)
233238}
234239
240+ /// Native structures use a different format for enums than the rest of the JSON file.
241+ /// If we detect a scoped field, convert it to the enum format expected by to_rust_type().
242+ ///
243+ /// Example: `TextServer::Direction` -> `enum::TextServer.Direction`.
235244fn normalize_native_structure_field_type ( field_type : & str ) -> String {
236- // native_structures uses a different format for enums than the
237- // rest of the JSON file. If we detect a scoped field, convert it
238- // to the enum format expected by to_rust_type.
239245 if field_type. contains ( "::" ) {
240246 let with_dot = field_type. replace ( "::" , "." ) ;
241247 format ! ( "enum::{}" , with_dot)
0 commit comments