diff options
Diffstat (limited to 'core/src/main/kotlin/Utilities')
-rw-r--r-- | core/src/main/kotlin/Utilities/nodeDebug.kt | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/core/src/main/kotlin/Utilities/nodeDebug.kt b/core/src/main/kotlin/Utilities/nodeDebug.kt index 8e2a7079..37655b0b 100644 --- a/core/src/main/kotlin/Utilities/nodeDebug.kt +++ b/core/src/main/kotlin/Utilities/nodeDebug.kt @@ -21,31 +21,31 @@ fun <T : DeclarationDescriptor> DocumentationNode<T>.pretty(prefix: String = "", .orEmpty() + if (children.isEmpty()) "\n" else "" } -fun Any.genericPretty(prefix: String = "", isLast: Boolean = true): String { - val nextPrefix = prefix + (if (isLast) ' ' else DOWN) + ' ' - - return prefix + (if (isLast) LAST else BRANCH) + this.stringify() + - allChildren().dropLast(1) - .map { it.genericPretty(nextPrefix, false) } - .plus(allChildren().lastOrNull()?.genericPretty(nextPrefix)) - .filterNotNull() - .takeIf { it.isNotEmpty() } - ?.joinToString(prefix = "\n", separator = "") - .orEmpty() + if (allChildren().isEmpty()) "\n" else "" -} +//fun Any.genericPretty(prefix: String = "", isLast: Boolean = true): String { +// val nextPrefix = prefix + (if (isLast) ' ' else DOWN) + ' ' +// +// return prefix + (if (isLast) LAST else BRANCH) + this.stringify() + +// allChildren().dropLast(1) +// .map { it.genericPretty(nextPrefix, false) } +// .plus(allChildren().lastOrNull()?.genericPretty(nextPrefix)) +// .filterNotNull() +// .takeIf { it.isNotEmpty() } +// ?.joinToString(prefix = "\n", separator = "") +// .orEmpty() + if (allChildren().isEmpty()) "\n" else "" +//} private fun Any.stringify() = when(this) { is ContentNode -> toString() + this.dci is PageNode -> this.name + this::class.simpleName else -> toString() } -private fun Any.allChildren() = when(this){ - is PageNode -> children + content - is ContentBlock -> this.children - is ContentHeader -> this.items - is ContentStyle -> this.items - is ContentSymbol -> this.parts - is ContentComment -> this.parts - is ContentGroup -> this.children - is ContentList -> this.items - else -> emptyList() -} +//private fun Any.allChildren() = when(this){ +// is PageNode -> children + content +// is ContentBlock -> this.children +// is ContentHeader -> this.items +// is ContentStyle -> this.items +// is ContentSymbol -> this.parts +// is ContentComment -> this.parts +// is ContentGroup -> this.children +// is ContentList -> this.items +// else -> emptyList() +//} |