diff options
| author | 魏曹先生 <1992414357@qq.com> | 2026-05-16 22:08:39 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2026-05-16 22:08:39 +0800 |
| commit | c48149a86eafcca967ef9aa947864fb4d0c727ea (patch) | |
| tree | c794eaef4435cb0f4ec8524861ebf3165f660097 /mingling_macros/src/lib.rs | |
| parent | 5fe400c006d9d143aa7b977cb13f95e7380754a5 (diff) | |
Replace hardcoded `ThisProgram` ident with shared constant
Diffstat (limited to 'mingling_macros/src/lib.rs')
| -rw-r--r-- | mingling_macros/src/lib.rs | 8 |
1 files changed, 7 insertions, 1 deletions
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<Mutex<BTreeSet<String>>> = @@ -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() } |
