[fir2ir] Pass 'ProcessCancelledException'

This commit is contained in:
Yan Zhulanow
2023-06-03 00:24:54 +09:00
committed by Space Team
parent 2600dc7f1e
commit a92c479344
2 changed files with 8 additions and 0 deletions
@@ -5,6 +5,7 @@
package org.jetbrains.kotlin.fir.backend
import com.intellij.openapi.progress.ProcessCanceledException
import org.jetbrains.kotlin.KtFakeSourceElementKind
import org.jetbrains.kotlin.builtins.StandardNames.BUILT_INS_PACKAGE_FQ_NAMES
import org.jetbrains.kotlin.descriptors.*
@@ -1860,6 +1861,8 @@ class Fir2IrDeclarationStorage(
private inline fun <R> convertCatching(element: FirElement, block: () -> R): R {
try {
return block()
} catch (e: ProcessCanceledException) {
throw e
} catch (e: Exception) {
errorWithAttachment("Exception was thrown during transformation of ${element::class.java}", cause = e) {
withFirEntry("element", element)
@@ -5,6 +5,7 @@
package org.jetbrains.kotlin.fir.backend.generators
import com.intellij.openapi.progress.ProcessCanceledException
import org.jetbrains.kotlin.KtFakeSourceElementKind
import org.jetbrains.kotlin.builtins.StandardNames
import org.jetbrains.kotlin.config.LanguageFeature
@@ -485,6 +486,8 @@ class CallAndReferenceGenerator(
}
}.applyTypeArguments(qualifiedAccess).applyReceivers(qualifiedAccess, convertedExplicitReceiver)
.applyCallArguments(qualifiedAccess)
} catch (e: ProcessCanceledException) {
throw e
} catch (e: Throwable) {
throw IllegalStateException(
"Error while translating ${qualifiedAccess.render()} " +
@@ -637,6 +640,8 @@ class CallAndReferenceGenerator(
else -> generateErrorCallExpression(startOffset, endOffset, calleeReference)
}
}.applyTypeArguments(lValue).applyReceivers(lValue, explicitReceiverExpression)
} catch (e: ProcessCanceledException) {
throw e
} catch (e: Throwable) {
throw IllegalStateException(
"Error while translating ${variableAssignment.render()} " +