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