@@ -19,7 +19,6 @@ use crate::{handle_mutually_exclusive_keys, util, ParseResult};
19
19
use proc_macro2:: { Delimiter , Group , Ident , TokenStream } ;
20
20
use quote:: spanned:: Spanned ;
21
21
use quote:: { format_ident, quote} ;
22
- use venial:: Impl ;
23
22
24
23
/// Attribute for user-declared function.
25
24
enum ItemAttrType {
@@ -72,19 +71,17 @@ struct SignalAttr {
72
71
pub no_builder : bool ,
73
72
}
74
73
75
- #[ derive( Default ) ]
76
- pub ( crate ) struct GodotApiHints {
77
- pub has_typed_signals : Option < bool > ,
78
- }
79
-
80
- // ----------------------------------------------------------------------------------------------------------------------------------------------
81
-
82
- pub struct InherentImplAttr {
74
+ pub ( crate ) struct InherentImplAttr {
83
75
/// For implementation reasons, there can be a single 'primary' impl block and 0 or more 'secondary' impl blocks.
84
76
/// For now, this is controlled by a key in the 'godot_api' attribute.
85
77
pub secondary : bool ,
78
+
79
+ /// When typed signal generation is explicitly disabled by the user.
80
+ pub no_typed_signals : bool ,
86
81
}
87
82
83
+ // ----------------------------------------------------------------------------------------------------------------------------------------------
84
+
88
85
/// Codegen for `#[godot_api] impl MyType`
89
86
pub fn transform_inherent_impl (
90
87
meta : InherentImplAttr ,
@@ -95,8 +92,6 @@ pub fn transform_inherent_impl(
95
92
let class_name_obj = util:: class_name_obj ( & class_name) ;
96
93
let prv = quote ! { :: godot:: private } ;
97
94
98
- let hints = extract_hint_attribute ( & mut impl_block) ?;
99
-
100
95
// Can add extra functions to the end of the impl block.
101
96
let ( funcs, signals) = process_godot_fns ( & class_name, & mut impl_block, meta. secondary ) ?;
102
97
let consts = process_godot_constants ( & mut impl_block) ?;
@@ -115,8 +110,12 @@ pub fn transform_inherent_impl(
115
110
116
111
// For each #[func] in this impl block, create one constant.
117
112
let func_name_constants = make_funcs_collection_constants ( & funcs, & class_name) ;
118
- let ( signal_registrations, signal_symbol_types) =
119
- make_signal_registrations ( & signals, & class_name, & class_name_obj, hints) ?;
113
+ let ( signal_registrations, signal_symbol_types) = make_signal_registrations (
114
+ & signals,
115
+ & class_name,
116
+ & class_name_obj,
117
+ meta. no_typed_signals ,
118
+ ) ?;
120
119
121
120
#[ cfg( feature = "codegen-full" ) ]
122
121
let rpc_registrations = crate :: class:: make_rpc_registrations_fn ( & class_name, & funcs) ;
@@ -214,19 +213,22 @@ pub fn transform_inherent_impl(
214
213
}
215
214
}
216
215
217
- fn extract_hint_attribute ( impl_block : & mut Impl ) -> ParseResult < GodotApiHints > {
218
- // Could possibly be extended with #[hint(signal_vis = pub)] or so.
219
-
220
- // #[hint(typed_signals)]
221
- let has_typed_signals;
216
+ /* Re-enable if we allow controlling declarative macros for signals (base_field_macro, visibility_macros).
217
+ fn extract_hint_attribute(impl_block: &mut venial:: Impl) -> ParseResult<GodotApiHints> {
218
+ // #[hint(has_base_field = BOOL)]
219
+ let has_base_field;
222
220
if let Some(mut hints) = KvParser::parse_remove(&mut impl_block.attributes, "hint")? {
223
- has_typed_signals = hints. handle_bool ( "typed_signals " ) ?;
221
+ has_base_field = hints.handle_bool("has_base_field ")?;
224
222
} else {
225
- has_typed_signals = None ;
223
+ has_base_field = None;
226
224
}
227
225
228
- Ok ( GodotApiHints { has_typed_signals } )
226
+ // #[hint(class_visibility = pub(crate))]
227
+ // ...
228
+
229
+ Ok(GodotApiHints { has_base_field })
229
230
}
231
+ */
230
232
231
233
fn process_godot_fns (
232
234
class_name : & Ident ,
0 commit comments