From a92c4793441c3832c333f8b3173c00313222c64e Mon Sep 17 00:00:00 2001 From: Yan Zhulanow Date: Sat, 3 Jun 2023 00:24:54 +0900 Subject: [PATCH] [fir2ir] Pass 'ProcessCancelledException' --- .../jetbrains/kotlin/fir/backend/Fir2IrDeclarationStorage.kt | 3 +++ .../fir/backend/generators/CallAndReferenceGenerator.kt | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrDeclarationStorage.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrDeclarationStorage.kt index 97106380d43..e6b86331625 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrDeclarationStorage.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrDeclarationStorage.kt @@ -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 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) diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/CallAndReferenceGenerator.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/CallAndReferenceGenerator.kt index 4092a88e055..1fae5532ee9 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/CallAndReferenceGenerator.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/CallAndReferenceGenerator.kt @@ -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()} " +