diff options
author | Nick Reid <40366972+nreid260@users.noreply.github.com> | 2023-01-26 08:22:15 -0800 |
---|---|---|
committer | Facebook GitHub Bot <facebook-github-bot@users.noreply.github.com> | 2023-01-26 08:22:15 -0800 |
commit | d2a8dbae8befa4cf3302fd1c9eb221e125d0eb42 (patch) | |
tree | 490d54ca1ed268a7431e6f4393d03d408bf24174 | |
parent | d400033dc2ceabd430d79316ab0c4780bcb27ab1 (diff) | |
download | ktfmt-d2a8dbae8befa4cf3302fd1c9eb221e125d0eb42.tar.gz |
De-inline OpsBuilder.block() (#378)
Summary:
As implemented, this function is unsafe to inline. Outer return from the callback would skip the call to builder.close().
Pull Request resolved: https://github.com/facebook/ktfmt/pull/378
Reviewed By: hick209
Differential Revision: D42768488
Pulled By: cgrushko
fbshipit-source-id: ce6888fd0e19f977315dc6dd2d95a906d946d6db
-rw-r--r-- | core/src/main/java/com/facebook/ktfmt/format/KotlinInputAstVisitor.kt | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/core/src/main/java/com/facebook/ktfmt/format/KotlinInputAstVisitor.kt b/core/src/main/java/com/facebook/ktfmt/format/KotlinInputAstVisitor.kt index dd17d56..c3c7506 100644 --- a/core/src/main/java/com/facebook/ktfmt/format/KotlinInputAstVisitor.kt +++ b/core/src/main/java/com/facebook/ktfmt/format/KotlinInputAstVisitor.kt @@ -2480,11 +2480,7 @@ class KotlinInputAstVisitor( * @param plusIndent the block level to pass to the block * @param block a code block to be run in this block level */ - private inline fun OpsBuilder.block( - plusIndent: Indent, - isEnabled: Boolean = true, - block: () -> Unit - ) { + private fun OpsBuilder.block(plusIndent: Indent, isEnabled: Boolean = true, block: () -> Unit) { if (isEnabled) { open(plusIndent) } |