Skip to content

Commit

Permalink
Optimize generated code (#541)
Browse files Browse the repository at this point in the history
  • Loading branch information
Foso authored Apr 28, 2024
1 parent 1ceaad2 commit b77b8af
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ data class FunctionData(
) {

fun toFunSpec(resolver: Resolver): FunSpec {
val returnTypeName = this.returnType.parameterType?.toTypeName()

return FunSpec.builder(this.name)
.addModifiers(mutableListOf(KModifier.OVERRIDE).also {
Expand Down Expand Up @@ -51,7 +50,7 @@ data class FunctionData(
this.returnType.parameterType.toTypeName().toString().removeWhiteSpaces()
)
.addStatement(
"return %L.%L<${returnTypeName}>(%L,${extDataClass.objectName})%L",
"return %L.%L(%L,${extDataClass.objectName})%L",
converterHelper.objectName,
if (this.isSuspend) {
"suspendRequest"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ interface TestService {
)


val expectedFunctionText = """return _converter.suspendRequest<io.ktor.client.statement.HttpStatement>(_typeData,_ext)!!"""
val expectedFunctionText = """return _converter.suspendRequest(_typeData,_ext)!!"""

val compilation = getCompilation(listOf(httpStatement, source))
val result = compilation.compile()
Expand Down

0 comments on commit b77b8af

Please sign in to comment.