-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rewrite
getParenthesisIndentationChange()
to return `IndentationAmo…
…unt` (#1473) ### What's done: * `isParenthesisAffectingIndent()` renamed to `getParenthesisIndentationChange()`. * The return type changed from `Boolean` to `IndentationAmount`. * The value returned by `getParenthesisIndentationChange()` is now stored on the "indentation stack" along with the corresponding element types. * This is merely a refactoring, so no user-visible behaviour has been changed. * See #1448.
- Loading branch information
1 parent
cb017a9
commit 632ac74
Showing
2 changed files
with
75 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
...rules/src/main/kotlin/org/cqfn/diktat/ruleset/rules/chapter3/files/IndentedElementType.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
@file:Suppress( | ||
"HEADER_MISSING_IN_NON_SINGLE_CLASS_FILE", | ||
"TOP_LEVEL_ORDER", | ||
) | ||
|
||
package org.cqfn.diktat.ruleset.rules.chapter3.files | ||
|
||
import org.jetbrains.kotlin.com.intellij.psi.tree.IElementType | ||
|
||
/** | ||
* An [IElementType] along with the indentation change it induces. | ||
*/ | ||
internal typealias IndentedElementType = Pair<IElementType, IndentationAmount> | ||
|
||
/** | ||
* @return the element type. | ||
*/ | ||
@Suppress("CUSTOM_GETTERS_SETTERS") | ||
internal val IndentedElementType.type: IElementType | ||
get() = | ||
first | ||
|
||
/** | ||
* @return the indentation change. | ||
*/ | ||
@Suppress("CUSTOM_GETTERS_SETTERS") | ||
internal val IndentedElementType.indentationChange: IndentationAmount | ||
get() = | ||
second |