mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-06-12 12:31:22 +00:00
Add support for empty enum variants and enum variants that start with a digit
This commit is contained in:
committed by
Alex Crichton
parent
61b3d52dc9
commit
07b4ef5838
@ -30,6 +30,8 @@ pub fn rust_ident(name: &str) -> Ident {
|
||||
panic!("tried to create empty Ident (from \"\")");
|
||||
} else if is_rust_keyword(name) {
|
||||
Ident::new(&format!("{}_", name), proc_macro2::Span::call_site())
|
||||
} else if name.chars().next().unwrap().is_ascii_digit() {
|
||||
Ident::new(&format!("N{}", name), proc_macro2::Span::call_site())
|
||||
} else {
|
||||
raw_ident(name)
|
||||
}
|
||||
|
Reference in New Issue
Block a user