88//! Runtime checks and inspection of Godot classes.
99
1010use crate :: builtin:: { GString , StringName , Variant , VariantType } ;
11- #[ cfg( debug_assertions ) ]
11+ #[ cfg( checks_at_least = "paranoid" ) ]
1212use crate :: classes:: { ClassDb , Object } ;
1313use crate :: meta:: CallContext ;
14- #[ cfg( debug_assertions ) ]
14+ #[ cfg( checks_at_least = "paranoid" ) ]
1515use crate :: meta:: ClassId ;
1616use crate :: obj:: { bounds, Bounds , Gd , GodotClass , InstanceId , RawGd , Singleton } ;
1717use crate :: sys;
@@ -191,6 +191,7 @@ where
191191 Gd :: < T > :: from_obj_sys ( object_ptr)
192192}
193193
194+ #[ cfg( checks_at_least = "balanced" ) ]
194195pub ( crate ) fn ensure_object_alive (
195196 instance_id : InstanceId ,
196197 old_object_ptr : sys:: GDExtensionObjectPtr ,
@@ -211,7 +212,7 @@ pub(crate) fn ensure_object_alive(
211212 ) ;
212213}
213214
214- #[ cfg( debug_assertions ) ]
215+ #[ cfg( checks_at_least = "paranoid" ) ]
215216pub ( crate ) fn ensure_object_inherits ( derived : ClassId , base : ClassId , instance_id : InstanceId ) {
216217 if derived == base
217218 || base == Object :: class_id ( ) // for Object base, anything inherits by definition
@@ -226,7 +227,7 @@ pub(crate) fn ensure_object_inherits(derived: ClassId, base: ClassId, instance_i
226227 )
227228}
228229
229- #[ cfg( debug_assertions ) ]
230+ #[ cfg( checks_at_least = "paranoid" ) ]
230231pub ( crate ) fn ensure_binding_not_null < T > ( binding : sys:: GDExtensionClassInstancePtr )
231232where
232233 T : GodotClass + Bounds < Declarer = bounds:: DeclUser > ,
@@ -254,7 +255,7 @@ where
254255// Implementation of this file
255256
256257/// Checks if `derived` inherits from `base`, using a cache for _successful_ queries.
257- #[ cfg( debug_assertions ) ]
258+ #[ cfg( checks_at_least = "paranoid" ) ]
258259fn is_derived_base_cached ( derived : ClassId , base : ClassId ) -> bool {
259260 use std:: collections:: HashSet ;
260261
0 commit comments