Skip to content

Fix UtUtils version parsing & comment formatting #1401

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 1 commit into from
Nov 21, 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 @@ -360,7 +360,7 @@ abstract class CgAbstractRenderer(
override fun visit(element: CgDocRegularStmt){
if (element.isEmpty()) return

print(element.stmt.replace("\n", "\n * "))
print(" * " + element.stmt)
}
override fun visit(element: CgDocClassLinkStmt) {
if (element.isEmpty()) return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,12 @@ internal object CgUtilClassConstructor {
id = utilsClassId
documentation = utilClassKind.utilClassDocumentation(codegenLanguage)
body = buildClassBody(utilsClassId) {
staticDeclarationRegions += CgStaticsRegion("Util methods", utilMethodProvider.utilMethodIds.map { CgUtilMethod(it) })
staticDeclarationRegions += CgStaticsRegion(
header = "Util methods",
content = utilMethodProvider.utilMethodIds.map { CgUtilMethod(it) })

nestedClassRegions += CgAuxiliaryNestedClassesRegion(
header = "Util classes",
nestedClasses = listOf(
CgAuxiliaryClass(utilMethodProvider.capturedArgumentClassId)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ sealed class UtilClassKind(
= CgDocumentationComment(
listOf(
CgDocRegularStmt("$utilClassKindCommentText \n"),
CgDocRegularStmt("$UTIL_CLASS_VERSION_COMMENT_PREFIX${utilClassVersion(codegenLanguage)}"),
CgDocRegularStmt("$UTIL_CLASS_VERSION_COMMENT_PREFIX${utilClassVersion(codegenLanguage)} \n"),
)
)

Expand Down Expand Up @@ -108,9 +108,9 @@ sealed class UtilClassKind(
codegenLanguage: CodegenLanguage
)
: UtilClassKind? {
return when (comment) {
RegularUtUtils(codegenLanguage).utilClassKindCommentText -> RegularUtUtils(codegenLanguage)
UtUtilsWithMockito(codegenLanguage).utilClassKindCommentText -> UtUtilsWithMockito(codegenLanguage)
return when {
comment.contains(RegularUtUtils(codegenLanguage).utilClassKindCommentText) -> RegularUtUtils(codegenLanguage)
comment.contains(UtUtilsWithMockito(codegenLanguage).utilClassKindCommentText) -> UtUtilsWithMockito(codegenLanguage)
else -> null
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,7 @@ object CodeGenerationController {
.map { comment -> comment.text }
.firstOrNull { text -> UtilClassKind.UTIL_CLASS_VERSION_COMMENT_PREFIX in text }
?.substringAfterLast(UtilClassKind.UTIL_CLASS_VERSION_COMMENT_PREFIX)
?.substringBefore("\n")
?.trim()
}

Expand Down