Skip to content

Commit

Permalink
fix: escape members from smithy because they might be reserved words (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
ajewellamz authored Jan 22, 2025
1 parent 5fb8654 commit 6475c2e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ private TokenTree operationClientFunction(
.stream()
.map(member ->
evalTemplate(
".set_$fieldName:L(inner_input.$fieldName:L)",
".set_$fieldName:L(inner_input.r#$fieldName:L)",
structureMemberVariables(member)
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -798,7 +798,7 @@ private RustFile operationOuterModule(
// but not on the Dafny side.
final MemberShape onlyMember = PositionalTrait.onlyMember(inputShape);
final String rustValue =
"input." + toSnakeCase(onlyMember.getMemberName());
"input.r#" + toSnakeCase(onlyMember.getMemberName());
variables.put(
"inputToDafny",
toDafny(inputShape, rustValue, true, false).toString()
Expand Down Expand Up @@ -1096,14 +1096,14 @@ private String generateValidationFunction(
) {
validationBlocks.add(
evalTemplate(
"$memberValidationFunctionName:L(&Some(input.$fieldName:L.clone()))?;",
"$memberValidationFunctionName:L(&Some(input.r#$fieldName:L.clone()))?;",
memberVariables
)
);
} else {
validationBlocks.add(
evalTemplate(
"$memberValidationFunctionName:L(&input.$fieldName:L)?;",
"$memberValidationFunctionName:L(&input.r#$fieldName:L)?;",
memberVariables
)
);
Expand Down Expand Up @@ -1851,7 +1851,7 @@ private String resourceOperationWrapperImpl(
// since on the Rust side there is still an input structure
// but not on the Dafny side.
final MemberShape onlyMember = PositionalTrait.onlyMember(inputShape);
final String rustValue = "input." + onlyMember.getMemberName() + "()";
final String rustValue = "input.r#" + onlyMember.getMemberName() + "()";
variables.put(
"inputFromDafny",
fromDafny(inputShape, rustValue, false, false).toString()
Expand Down Expand Up @@ -1912,7 +1912,7 @@ private String resourceOperationDafnyWrapperImpl(
// but not on the Dafny side.
final MemberShape onlyMember = PositionalTrait.onlyMember(inputShape);
final String rustValue =
"input." + toSnakeCase(onlyMember.getMemberName());
"input.r#" + toSnakeCase(onlyMember.getMemberName());
variables.put(
"inputToDafny",
toDafny(inputShape, rustValue, true, false).toString()
Expand Down

0 comments on commit 6475c2e

Please sign in to comment.