From c48149a86eafcca967ef9aa947864fb4d0c727ea Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Sat, 16 May 2026 22:08:39 +0800 Subject: Replace hardcoded `ThisProgram` ident with shared constant --- mingling_macros/src/lib.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'mingling_macros/src/lib.rs') diff --git a/mingling_macros/src/lib.rs b/mingling_macros/src/lib.rs index 175c7e5..7dd2fe2 100644 --- a/mingling_macros/src/lib.rs +++ b/mingling_macros/src/lib.rs @@ -44,6 +44,12 @@ mod renderer; #[cfg(feature = "comp")] mod suggest; +pub(crate) const DEFAULT_PROGRAM_NAME: &str = "ThisProgram"; + +pub(crate) fn default_program_ident() -> Ident { + Ident::new(DEFAULT_PROGRAM_NAME, proc_macro2::Span::call_site()) +} + // Global variables #[cfg(feature = "general_renderer")] pub(crate) static GENERAL_RENDERERS: Lazy>> = @@ -1549,7 +1555,7 @@ pub fn suggest_enum(input: TokenStream) -> TokenStream { fn read_name(input: &TokenStream) -> Ident { if input.is_empty() { - Ident::new("ThisProgram", proc_macro2::Span::call_site()) + Ident::new(DEFAULT_PROGRAM_NAME, proc_macro2::Span::call_site()) } else { syn::parse(input.clone()).unwrap() } -- cgit