From e3e2f49bf59c565a8eb3b765207913de5733af60 Mon Sep 17 00:00:00 2001 From: rishav-karanjit Date: Wed, 8 Jan 2025 15:27:57 -0800 Subject: [PATCH] fix unintended code change --- ...fnyLocalServiceTypeConversionProtocol.java | 90 +++++++++---------- 1 file changed, 45 insertions(+), 45 deletions(-) diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithygo/localservice/DafnyLocalServiceTypeConversionProtocol.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithygo/localservice/DafnyLocalServiceTypeConversionProtocol.java index cf1569a24..df365be41 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithygo/localservice/DafnyLocalServiceTypeConversionProtocol.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithygo/localservice/DafnyLocalServiceTypeConversionProtocol.java @@ -366,56 +366,56 @@ public void generateSerializers(final GenerationContext context) { ); } } - }); - if ( - !alreadyVisited.contains(resourceShape.toShapeId()) && - resourceShape - .toShapeId() - .getNamespace() - .equals(serviceShape.toShapeId().getNamespace()) - ) { - alreadyVisited.add(resourceShape.toShapeId()); - writerDelegator.useFileWriter( - "%s/%s".formatted( + if ( + !alreadyVisited.contains(resourceShape.toShapeId()) && + resourceShape + .toShapeId() + .getNamespace() + .equals(serviceShape.toShapeId().getNamespace()) + ) { + alreadyVisited.add(resourceShape.toShapeId()); + writerDelegator.useFileWriter( + "%s/%s".formatted( + SmithyNameResolver.shapeNamespace(serviceShape), + TO_DAFNY + ), SmithyNameResolver.shapeNamespace(serviceShape), - TO_DAFNY - ), - SmithyNameResolver.shapeNamespace(serviceShape), - writer -> { - var goBody = - """ - return nativeResource.(*%s).Impl - """.formatted(resourceShape.getId().getName()); - if (resourceShape.hasTrait(ExtendableTrait.class)) { - goBody = - """ - val, ok := nativeResource.(*%s) - if ok { - return val.Impl + writer -> { + var goBody = + """ + return nativeResource.(*%s).Impl + """.formatted(resourceShape.getId().getName()); + if (resourceShape.hasTrait(ExtendableTrait.class)) { + goBody = + """ + val, ok := nativeResource.(*%s) + if ok { + return val.Impl + } + return %s{&%sNativeWrapper{Impl: nativeResource}}.Impl + """.formatted( + resourceShape.getId().getName(), + resourceShape.getId().getName(), + resourceShape.getId().getName() + ); } - return %s{&%sNativeWrapper{Impl: nativeResource}}.Impl - """.formatted( - resourceShape.getId().getName(), - resourceShape.getId().getName(), - resourceShape.getId().getName() - ); - } - writer.write( - """ - func $L_ToDafny(nativeResource $L.I$L) $L.I$L { - $L + writer.write( + """ + func $L_ToDafny(nativeResource $L.I$L) $L.I$L { + $L + } + """, + resourceShape.getId().getName(), + SmithyNameResolver.smithyTypesNamespace(resourceShape), + resourceShape.getId().getName(), + DafnyNameResolver.dafnyTypesNamespace(resourceShape), + resourceShape.getId().getName(), + goBody + ); } - """, - resourceShape.getId().getName(), - SmithyNameResolver.smithyTypesNamespace(resourceShape), - resourceShape.getId().getName(), - DafnyNameResolver.dafnyTypesNamespace(resourceShape), - resourceShape.getId().getName(), - goBody ); } - ); - } + }); } } generateErrorSerializer(context);