Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit bd9869b

Browse files
committedJul 7, 2024·
fix: mistake in refactoring.
1 parent b9968bf commit bd9869b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed
 

‎tasks/ast_codegen/src/generators/ast_builder.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,12 @@ fn enum_builder_name(enum_name: String, var_name: String) -> Ident {
9292
}
9393

9494
fn struct_builder_name(struct_: &RStruct) -> Ident {
95-
format_ident!("{}", fn_ident_name(struct_.ident().to_string()))
95+
static RUST_KEYWORDS: [&str; 1] = ["super"];
96+
let mut ident = fn_ident_name(struct_.ident().to_string());
97+
if RUST_KEYWORDS.contains(&ident.as_str()) {
98+
ident.push('_');
99+
}
100+
format_ident!("{ident}")
96101
}
97102

98103
fn generate_builder_fn(ty: &TypeRef, ctx: &CodegenCtx) -> Option<TokenStream> {

0 commit comments

Comments
 (0)