File tree Expand file tree Collapse file tree 2 files changed +2
-2
lines changed
codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core Expand file tree Collapse file tree 2 files changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -78,7 +78,7 @@ class RustReservedWordSymbolProvider(
7878 return base.toSymbol(shape)
7979 }
8080 val previousName = base.toMemberName(shape)
81- val escapedName = this .toMemberName(shape)
81+ val escapedName = this .toMemberName(shape).replace( Regex ( " ^(_* \\ d) " ), " _$1 " )
8282 // if the names don't match and it isn't a simple escaping with `r#`, record a rename
8383 renamedSymbol.toBuilder().name(escapedName)
8484 .letIf(escapedName != previousName && ! escapedName.contains(" r#" )) {
Original file line number Diff line number Diff line change @@ -102,7 +102,7 @@ class EnumMemberModel(
102102 parentShape : Shape ,
103103 definition : EnumDefinition ,
104104 ): MaybeRenamed ? {
105- val name = definition.name.orNull()?.toPascalCase() ? : return null
105+ val name = definition.name.orNull()?.toPascalCase()?.replace( Regex ( " ^(_* \\ d) " ), " _$1 " ) ? : return null
106106 // Create a fake member shape for symbol look up until we refactor to use EnumShape
107107 val fakeMemberShape =
108108 MemberShape .builder().id(parentShape.id.withMember(name)).target(" smithy.api#String" ).build()
You can’t perform that action at this time.
0 commit comments