Process UastContext service absence (EA-100670)
This commit is contained in:
+16
-9
@@ -44,17 +44,24 @@ class InvokeOperatorReferenceSearcher(
|
|||||||
|
|
||||||
init {
|
init {
|
||||||
val uastContext = ServiceManager.getService<UastContext>(targetFunction.project, UastContext::class.java)
|
val uastContext = ServiceManager.getService<UastContext>(targetFunction.project, UastContext::class.java)
|
||||||
val uMethod = uastContext.convertOpt<UMethod>(targetDeclaration, null)
|
callArgumentsSize = when {
|
||||||
val uastParameters = uMethod?.uastParameters
|
uastContext != null -> {
|
||||||
|
val uMethod = uastContext.convertOpt<UMethod>(targetDeclaration, null)
|
||||||
|
val uastParameters = uMethod?.uastParameters
|
||||||
|
|
||||||
val isStableNumberOfArguments = uastParameters != null && uastParameters.none { it.uastInitializer != null || it.isVarArgs }
|
val isStableNumberOfArguments = uastParameters != null && uastParameters.none { it.uastInitializer != null || it.isVarArgs }
|
||||||
callArgumentsSize = if (isStableNumberOfArguments) {
|
if (isStableNumberOfArguments) {
|
||||||
val numberOfArguments = uastParameters!!.size
|
val numberOfArguments = uastParameters!!.size
|
||||||
when {
|
when {
|
||||||
targetFunction.isExtensionDeclaration() -> numberOfArguments - 1
|
targetFunction.isExtensionDeclaration() -> numberOfArguments - 1
|
||||||
else -> numberOfArguments
|
else -> numberOfArguments
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else null
|
||||||
}
|
}
|
||||||
} else null
|
|
||||||
|
else -> null
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun processPossibleReceiverExpression(expression: KtExpression) {
|
override fun processPossibleReceiverExpression(expression: KtExpression) {
|
||||||
|
|||||||
Reference in New Issue
Block a user