From ebdebf9f9842c9601a83a27e48a9c334085d5dcc Mon Sep 17 00:00:00 2001 From: nickreid Date: Thu, 24 Feb 2022 12:20:59 -0800 Subject: [PATCH] Noop: refactor KDocWriter to eliminate some dead constructs (#288) Summary: Pull Request resolved: https://github.com/facebookincubator/ktfmt/pull/288 Reviewed By: strulovich Differential Revision: D34447973 Pulled By: cgrushko fbshipit-source-id: 3f0b02244b62ad302bf008526fa17bc30472ef1e --- .../com/facebook/ktfmt/kdoc/KDocWriter.kt | 112 ++++++------------ 1 file changed, 34 insertions(+), 78 deletions(-) diff --git a/core/src/main/java/com/facebook/ktfmt/kdoc/KDocWriter.kt b/core/src/main/java/com/facebook/ktfmt/kdoc/KDocWriter.kt index 1b1d8b4c..8d7db5db 100644 --- a/core/src/main/java/com/facebook/ktfmt/kdoc/KDocWriter.kt +++ b/core/src/main/java/com/facebook/ktfmt/kdoc/KDocWriter.kt @@ -23,8 +23,6 @@ import com.facebook.ktfmt.kdoc.KDocToken.Type.CODE_BLOCK_MARKER import com.facebook.ktfmt.kdoc.KDocToken.Type.HEADER_OPEN_TAG import com.facebook.ktfmt.kdoc.KDocToken.Type.LIST_ITEM_OPEN_TAG import com.facebook.ktfmt.kdoc.KDocToken.Type.PARAGRAPH_OPEN_TAG -import com.facebook.ktfmt.kdoc.KDocWriter.AutoIndent.AUTO_INDENT -import com.facebook.ktfmt.kdoc.KDocWriter.AutoIndent.NO_AUTO_INDENT import com.facebook.ktfmt.kdoc.KDocWriter.RequestedWhitespace.BLANK_LINE import com.facebook.ktfmt.kdoc.KDocWriter.RequestedWhitespace.CONDITIONAL_WHITESPACE import com.facebook.ktfmt.kdoc.KDocWriter.RequestedWhitespace.NEWLINE @@ -41,7 +39,7 @@ import com.google.common.collect.Sets.immutableEnumSet * must compute and store the answer to questions like "How many levels of nested HTML list are we * inside?" */ -internal class KDocWriter(private val blockIndent: Int, private val maxLineLength: Int) { +internal class KDocWriter(blockIndentCount: Int, private val maxLineLength: Int) { /** * Tokens that are always pinned to the following token. For example, `

` in `

Foo bar` (never @@ -55,19 +53,12 @@ internal class KDocWriter(private val blockIndent: Int, private val maxLineLengt immutableEnumSet(LIST_ITEM_OPEN_TAG, PARAGRAPH_OPEN_TAG, HEADER_OPEN_TAG) private val output = StringBuilder() - /** - * Whether we are inside an `

  • ` element, excluding the case in which the `
  • ` contains a - * `