Debugger: Prohibit 'suspend fun' calls in evaluated expressions
Currently, it's impossible to call suspend functions in evaluated code fragments (see KT-31701). This commit officially prohibits such calls, so users will see a semi-friendly error message.
This commit is contained in:
+12
@@ -184,6 +184,18 @@ class CodeFragmentParameterAnalyzer(
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
override fun visitCallExpression(expression: KtCallExpression, data: Unit?): Void? {
|
||||
val resolvedCall = expression.getResolvedCall(bindingContext)
|
||||
if (resolvedCall != null) {
|
||||
val descriptor = resolvedCall.resultingDescriptor
|
||||
if (descriptor is FunctionDescriptor && descriptor.isSuspend) {
|
||||
throw EvaluateExceptionUtil.createEvaluateException("Evaluation of 'suspend' calls is not supported")
|
||||
}
|
||||
}
|
||||
|
||||
return super.visitCallExpression(expression, data)
|
||||
}
|
||||
}, Unit)
|
||||
|
||||
return CodeFragmentParameterInfo(parameters.values.toList(), crossingBounds)
|
||||
|
||||
Reference in New Issue
Block a user