filter whitespace nodes when converting list of elements
This commit is contained in:
committed by
Pavel V. Talanov
parent
1999c246f2
commit
7cbff97c6e
@@ -303,9 +303,9 @@ public open class Converter() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun caseForObject(method: PsiMethod): Boolean {
|
private fun caseForObject(method: PsiMethod): Boolean {
|
||||||
var containing: PsiClass? = method.getContainingClass()
|
val containing: PsiClass? = method.getContainingClass()
|
||||||
if (containing != null) {
|
if (containing != null) {
|
||||||
for (s : PsiClassType? in containing?.getSuperTypes()) {
|
for (s : PsiClassType? in containing.getSuperTypes()) {
|
||||||
val canonicalText: String? = s?.getCanonicalText()
|
val canonicalText: String? = s?.getCanonicalText()
|
||||||
if (canonicalText != JAVA_LANG_OBJECT && !getClassIdentifiers().contains(canonicalText)) {
|
if (canonicalText != JAVA_LANG_OBJECT && !getClassIdentifiers().contains(canonicalText)) {
|
||||||
return true
|
return true
|
||||||
@@ -319,7 +319,7 @@ public open class Converter() {
|
|||||||
if (block == null)
|
if (block == null)
|
||||||
return Block.EMPTY_BLOCK
|
return Block.EMPTY_BLOCK
|
||||||
|
|
||||||
return Block(block.getChildren().map { statementToStatement(it) }, notEmpty)
|
return Block(statementsToStatementList(block.getChildren()), notEmpty)
|
||||||
}
|
}
|
||||||
|
|
||||||
public open fun blockToBlock(block: PsiCodeBlock?): Block {
|
public open fun blockToBlock(block: PsiCodeBlock?): Block {
|
||||||
@@ -327,11 +327,11 @@ public open class Converter() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public open fun statementsToStatementList(statements: Array<PsiElement?>): List<Element> {
|
public open fun statementsToStatementList(statements: Array<PsiElement?>): List<Element> {
|
||||||
return statements.map { statementToStatement(it) }
|
return statements.filterNot { it is PsiWhiteSpace }.map { statementToStatement(it) }
|
||||||
}
|
}
|
||||||
|
|
||||||
public open fun statementsToStatementList(statements: List<PsiElement?>): List<Element> {
|
public open fun statementsToStatementList(statements: List<PsiElement?>): List<Element> {
|
||||||
return statements.map { statementToStatement(it) }
|
return statements.filterNot { it is PsiWhiteSpace }.map { statementToStatement(it) }
|
||||||
}
|
}
|
||||||
|
|
||||||
public open fun statementToStatement(s: PsiElement?): Element {
|
public open fun statementToStatement(s: PsiElement?): Element {
|
||||||
|
|||||||
Reference in New Issue
Block a user