Skip to content

Commit 1641757

Browse files
committed
ClassName construction from dynamic values
Extends the caching mechanism to accept not-yet-seen runtime strings and map them to ClassName instances. Useful for Godot introspection APIs returning class names.
1 parent d214181 commit 1641757

File tree

4 files changed

+332
-103
lines changed

4 files changed

+332
-103
lines changed

godot-codegen/src/generator/classes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ fn make_class(class: &Class, ctx: &mut Context, view: &ApiView) -> GeneratedClas
248248
// Optimization note: instead of lazy init, could use separate static which is manually initialized during registration.
249249
static CLASS_NAME: std::sync::OnceLock<ClassName> = std::sync::OnceLock::new();
250250

251-
let name: &'static ClassName = CLASS_NAME.get_or_init(|| ClassName::alloc_next_ascii(#class_name_cstr));
251+
let name: &'static ClassName = CLASS_NAME.get_or_init(|| ClassName::__alloc_next_ascii(#class_name_cstr));
252252
*name
253253
}
254254

0 commit comments

Comments
 (0)