Change semantics of getObjectKeyword() function

This commit is contained in:
Yan Zhulanow
2016-03-31 19:55:54 +03:00
parent 41979de71e
commit 726bfca540
5 changed files with 11 additions and 11 deletions
@@ -161,7 +161,7 @@ class UnusedSymbolInspection : AbstractKotlinInspection() {
if (declaration is KtClassOrObject && classOrObjectHasTextUsages(declaration)) return
val (inspectionTarget, textRange) = if (isCompanionObject && declaration.nameIdentifier == null) {
val objectKeyword = (declaration as KtObjectDeclaration).getObjectKeyword()
val objectKeyword = (declaration as KtObjectDeclaration).getObjectKeyword()!!
Pair(declaration, TextRange(0, objectKeyword.startOffsetInParent + objectKeyword.textLength))
} else {
Pair(declaration.nameIdentifier!!, null)
@@ -103,7 +103,7 @@ open class ChangeVisibilityModifierIntention protected constructor(
is KtNamedFunction -> declaration.funKeyword?.textRange
is KtProperty -> declaration.valOrVarKeyword.textRange
is KtClass -> declaration.getClassOrInterfaceKeyword()?.textRange
is KtObjectDeclaration -> declaration.getObjectKeyword().textRange
is KtObjectDeclaration -> declaration.getObjectKeyword()?.textRange
is KtPrimaryConstructor -> declaration.valueParameterList?.let { TextRange.from(it.startOffset, 0) } //TODO: use constructor keyword if exist
is KtSecondaryConstructor -> declaration.getConstructorKeyword().textRange
is KtParameter -> declaration.valOrVarKeyword?.textRange
@@ -79,7 +79,7 @@ class ObjectLiteralToLambdaIntention : SelfTargetingRangeIntention<KtObjectLiter
return null
}
return TextRange(element.objectDeclaration.getObjectKeyword().startOffset, baseTypeRef.endOffset)
return TextRange(element.objectDeclaration.getObjectKeyword()!!.startOffset, baseTypeRef.endOffset)
}
override fun applyTo(element: KtObjectLiteralExpression, editor: Editor?) {