Skip to content

Commit 5405242

Browse files
committed
Remove unnecessary useShapeWriter method
1 parent 28a74d0 commit 5405242

File tree

2 files changed

+8
-22
lines changed

2 files changed

+8
-22
lines changed

smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/CodegenVisitor.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ public Void stringShape(StringShape shape) {
347347
@Override
348348
public Void operationShape(OperationShape operation) {
349349
if (settings.generateServerSdk()) {
350-
writers.useShapeWriter(operation, symbolProvider, w -> {
350+
writers.useShapeWriter(operation, w -> {
351351
ServerGenerator.generateOperationHandler(symbolProvider, service, operation, w);
352352
});
353353
}
@@ -395,11 +395,11 @@ public Void serviceShape(ServiceShape shape) {
395395
protocolGenerator.generateRequestDeserializers(serverContext);
396396
protocolGenerator.generateResponseSerializers(serverContext);
397397
protocolGenerator.generateFrameworkErrorSerializer(serverContext);
398-
writers.useShapeWriter(shape, symbolProvider, w -> {
398+
writers.useShapeWriter(shape, w -> {
399399
protocolGenerator.generateServiceHandlerFactory(serverContext.withWriter(w));
400400
});
401401
for (OperationShape operation: TopDownIndex.of(model).getContainedOperations(service)) {
402-
writers.useShapeWriter(operation, symbolProvider, w -> {
402+
writers.useShapeWriter(operation, w -> {
403403
protocolGenerator.generateOperationHandlerFactory(serverContext.withWriter(w), operation);
404404
});
405405
}
@@ -462,7 +462,7 @@ private void generateClient(ServiceShape shape) {
462462
private void generateServiceInterface(ServiceShape shape) {
463463
TopDownIndex topDownIndex = TopDownIndex.of(model);
464464
Set<OperationShape> operations = new TreeSet<>(topDownIndex.getContainedOperations(shape));
465-
writers.useShapeWriter(shape, symbolProvider, writer -> {
465+
writers.useShapeWriter(shape, writer -> {
466466
ServerGenerator.generateOperationsType(symbolProvider, shape, operations, writer);
467467
ServerGenerator.generateServerInterfaces(symbolProvider, shape, operations, writer);
468468
ServerGenerator.generateServiceHandler(symbolProvider, shape, operations, writer);
@@ -484,7 +484,7 @@ private void generateCommands(ServiceShape shape) {
484484

485485
if (settings.generateServerSdk()) {
486486
ServerCommandGenerator.writeIndex(model, service, symbolProvider, fileManifest);
487-
writers.useShapeWriter(operation, symbolProvider, commandWriter -> new ServerCommandGenerator(
487+
writers.useShapeWriter(operation, commandWriter -> new ServerCommandGenerator(
488488
settings, model, operation, symbolProvider, commandWriter,
489489
protocolGenerator, applicationProtocol).run());
490490
}

smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/TypeScriptDelegator.java

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,11 @@ List<SymbolDependency> getDependencies() {
8585
* with the writer.
8686
*
8787
* @param shape Shape to create the writer for.
88-
* @param provider The symbol provider to use (instead of the default one).
8988
* @param writerConsumer Consumer that accepts and works with the file.
9089
*/
91-
void useShapeWriter(Shape shape, SymbolProvider provider, Consumer<TypeScriptWriter> writerConsumer) {
90+
void useShapeWriter(Shape shape, Consumer<TypeScriptWriter> writerConsumer) {
9291
// Checkout/create the appropriate writer for the shape.
93-
Symbol symbol = provider.toSymbol(shape);
92+
Symbol symbol = symbolProvider.toSymbol(shape);
9493
String fileName = symbol.getDefinitionFile();
9594
if (!fileName.startsWith(Paths.get(".", CodegenUtils.SOURCE_FOLDER).toString())) {
9695
fileName = Paths.get(".", CodegenUtils.SOURCE_FOLDER, fileName).toString();
@@ -106,26 +105,13 @@ void useShapeWriter(Shape shape, SymbolProvider provider, Consumer<TypeScriptWri
106105
// Allow integrations to do things like add onSection callbacks.
107106
// These onSection callbacks are removed when popState is called.
108107
for (TypeScriptIntegration integration : integrations) {
109-
integration.onShapeWriterUse(settings, model, provider, writer, shape);
108+
integration.onShapeWriterUse(settings, model, symbolProvider, writer, shape);
110109
}
111110

112111
writerConsumer.accept(writer);
113112
writer.popState();
114113
}
115114

116-
/**
117-
* Gets a previously created writer or creates a new one if needed.
118-
*
119-
* <p>Any imports required by the given symbol are automatically registered
120-
* with the writer.
121-
*
122-
* @param shape Shape to create the writer for.
123-
* @param writerConsumer Consumer that accepts and works with the file.
124-
*/
125-
void useShapeWriter(Shape shape, Consumer<TypeScriptWriter> writerConsumer) {
126-
useShapeWriter(shape, symbolProvider, writerConsumer);
127-
}
128-
129115
/**
130116
* Gets a previously created writer or creates a new one if needed
131117
* and adds a new line if the writer already exists.

0 commit comments

Comments
 (0)