File tree 3 files changed +20
-4
lines changed
3 files changed +20
-4
lines changed Original file line number Diff line number Diff line change @@ -456,6 +456,22 @@ impl ClassMethod {
456
456
FnQualifier :: from_const_static ( is_actually_const, method. is_static )
457
457
} ;
458
458
459
+ // Since Godot 4.4, GDExtension advertises whether virtual methods have a default implementation or are required to be overridden.
460
+ #[ cfg( before_api = "4.4" ) ]
461
+ let is_virtual_required = special_cases:: is_virtual_method_required (
462
+ & class_name. rust_ty . to_string ( ) ,
463
+ rust_method_name,
464
+ ) ;
465
+
466
+ #[ cfg( since_api = "4.4" ) ]
467
+ let is_virtual_required = method. is_virtual
468
+ && method. is_required . unwrap_or_else ( || {
469
+ panic ! (
470
+ "virtual method {}::{} lacks field `is_required`" ,
471
+ class_name. rust_ty, rust_method_name
472
+ ) ;
473
+ } ) ;
474
+
459
475
Some ( Self {
460
476
common : FunctionCommon {
461
477
name : rust_method_name. to_string ( ) ,
@@ -464,10 +480,7 @@ impl ClassMethod {
464
480
return_value : FnReturn :: new ( & method. return_value , ctx) ,
465
481
is_vararg : method. is_vararg ,
466
482
is_private,
467
- is_virtual_required : special_cases:: is_virtual_method_required (
468
- & class_name. rust_ty . to_string ( ) ,
469
- rust_method_name,
470
- ) ,
483
+ is_virtual_required,
471
484
direction,
472
485
} ,
473
486
qualifier,
Original file line number Diff line number Diff line change @@ -220,6 +220,8 @@ pub struct JsonClassMethod {
220
220
pub is_vararg : bool ,
221
221
pub is_static : bool ,
222
222
pub is_virtual : bool ,
223
+ #[ cfg( since_api = "4.4" ) ]
224
+ pub is_required : Option < bool > , // Only virtual functions have this field.
223
225
pub hash : Option < i64 > ,
224
226
pub return_value : Option < JsonMethodReturn > ,
225
227
pub arguments : Option < Vec < JsonMethodArg > > ,
Original file line number Diff line number Diff line change @@ -389,6 +389,7 @@ pub fn get_interface_extra_docs(trait_name: &str) -> Option<&'static str> {
389
389
}
390
390
}
391
391
392
+ #[ cfg( before_api = "4.4" ) ]
392
393
pub fn is_virtual_method_required ( class_name : & str , method : & str ) -> bool {
393
394
match ( class_name, method) {
394
395
( "ScriptLanguageExtension" , _) => method != "get_doc_comment_delimiters" ,
You can’t perform that action at this time.
0 commit comments