Skip to content

Remove usused code from ProtocolGenerator.GenerationContext #564

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,6 @@ void execute() {
ShapeId protocol = protocolGenerator.getProtocol();
ProtocolGenerator.GenerationContext context = new ProtocolGenerator.GenerationContext();
context.setProtocolName(protocolGenerator.getName());
context.setIntegrations(integrations);
context.setModel(model);
context.setService(service);
context.setSettings(settings);
Expand Down Expand Up @@ -337,7 +336,6 @@ public Void serviceShape(ServiceShape shape) {
writers.useFileWriter(fileName, writer -> {
ProtocolGenerator.GenerationContext context = new ProtocolGenerator.GenerationContext();
context.setProtocolName(protocolGenerator.getName());
context.setIntegrations(integrations);
context.setModel(model);
context.setService(shape);
context.setSettings(settings);
Expand All @@ -348,17 +346,15 @@ public Void serviceShape(ServiceShape shape) {
protocolGenerator.generateResponseDeserializers(context);
}
if (context.getSettings().generateServerSdk()) {
ProtocolGenerator.GenerationContext serverContext =
context.withSymbolProvider(symbolProvider);
protocolGenerator.generateRequestDeserializers(serverContext);
protocolGenerator.generateResponseSerializers(serverContext);
protocolGenerator.generateFrameworkErrorSerializer(serverContext);
protocolGenerator.generateRequestDeserializers(context);
protocolGenerator.generateResponseSerializers(context);
protocolGenerator.generateFrameworkErrorSerializer(context);
writers.useShapeWriter(shape, w -> {
protocolGenerator.generateServiceHandlerFactory(serverContext.withWriter(w));
protocolGenerator.generateServiceHandlerFactory(context.withWriter(w));
});
for (OperationShape operation: TopDownIndex.of(model).getContainedOperations(service)) {
writers.useShapeWriter(operation, w -> {
protocolGenerator.generateOperationHandlerFactory(serverContext.withWriter(w), operation);
protocolGenerator.generateOperationHandlerFactory(context.withWriter(w), operation);
});
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
package software.amazon.smithy.typescript.codegen.integration;

import java.util.Collection;
import java.util.List;
import java.util.function.Supplier;
import java.util.stream.Collectors;
import software.amazon.smithy.codegen.core.CodegenException;
Expand Down Expand Up @@ -274,7 +273,6 @@ class GenerationContext {
private SymbolProvider symbolProvider;
private TypeScriptWriter writer;
private Supplier<TypeScriptWriter> writerSupplier;
private List<TypeScriptIntegration> integrations;
private String protocolName;

public TypeScriptSettings getSettings() {
Expand Down Expand Up @@ -330,14 +328,6 @@ public void setDeferredWriter(Supplier<TypeScriptWriter> writerSupplier) {
}
}

public List<TypeScriptIntegration> getIntegrations() {
return integrations;
}

public void setIntegrations(List<TypeScriptIntegration> integrations) {
this.integrations = integrations;
}

public String getProtocolName() {
return protocolName;
}
Expand All @@ -354,17 +344,10 @@ public GenerationContext copy() {
copy.setSymbolProvider(symbolProvider);
copy.setWriter(writer);
copy.setDeferredWriter(writerSupplier);
copy.setIntegrations(integrations);
copy.setProtocolName(protocolName);
return copy;
}

public GenerationContext withSymbolProvider(SymbolProvider newProvider) {
GenerationContext copyContext = copy();
copyContext.setSymbolProvider(newProvider);
return copyContext;
}

public GenerationContext withWriter(TypeScriptWriter newWriter) {
GenerationContext copyContext = copy();
copyContext.setWriter(newWriter);
Expand Down