Initialize 'source' property of FirCatch objects properly
^KT-56923: Fixed ^KT-56755: Fixed
This commit is contained in:
committed by
teamcity
parent
83845fbab5
commit
17e6099b53
+6
@@ -349,6 +349,12 @@ public class FirLightTreeBytecodeTextTestGenerated extends AbstractFirLightTreeB
|
||||
runTest("compiler/testData/codegen/bytecodeText/kt5016intOrNull.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt56923.kt")
|
||||
public void testKt56923() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeText/kt56923.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt7188.kt")
|
||||
public void testKt7188() throws Exception {
|
||||
|
||||
+6
@@ -349,6 +349,12 @@ public class FirPsiBytecodeTextTestGenerated extends AbstractFirPsiBytecodeTextT
|
||||
runTest("compiler/testData/codegen/bytecodeText/kt5016intOrNull.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt56923.kt")
|
||||
public void testKt56923() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeText/kt56923.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt7188.kt")
|
||||
public void testKt7188() throws Exception {
|
||||
|
||||
+5
-4
@@ -1191,7 +1191,7 @@ class ExpressionsConverter(
|
||||
*/
|
||||
private fun convertTryExpression(tryExpression: LighterASTNode): FirExpression {
|
||||
lateinit var tryBlock: FirBlock
|
||||
val catchClauses = mutableListOf<Pair<ValueParameter?, FirBlock>>()
|
||||
val catchClauses = mutableListOf<Triple<ValueParameter?, FirBlock, KtLightSourceElement>>()
|
||||
var finallyBlock: FirBlock? = null
|
||||
tryExpression.forEachChildren {
|
||||
when (it.tokenType) {
|
||||
@@ -1204,7 +1204,7 @@ class ExpressionsConverter(
|
||||
source = tryExpression.toFirSourceElement()
|
||||
this.tryBlock = tryBlock
|
||||
this.finallyBlock = finallyBlock
|
||||
for ((parameter, block) in catchClauses) {
|
||||
for ((parameter, block, clauseSource) in catchClauses) {
|
||||
if (parameter == null) continue
|
||||
catches += buildCatch {
|
||||
this.parameter = buildProperty {
|
||||
@@ -1222,6 +1222,7 @@ class ExpressionsConverter(
|
||||
it.isCatchParameter = true
|
||||
}
|
||||
this.block = block
|
||||
this.source = clauseSource
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1230,7 +1231,7 @@ class ExpressionsConverter(
|
||||
/**
|
||||
* @see org.jetbrains.kotlin.parsing.KotlinExpressionParsing.parseTry
|
||||
*/
|
||||
private fun convertCatchClause(catchClause: LighterASTNode): Pair<ValueParameter?, FirBlock>? {
|
||||
private fun convertCatchClause(catchClause: LighterASTNode): Triple<ValueParameter?, FirBlock, KtLightSourceElement>? {
|
||||
var valueParameter: ValueParameter? = null
|
||||
var blockNode: LighterASTNode? = null
|
||||
catchClause.forEachChildren {
|
||||
@@ -1241,7 +1242,7 @@ class ExpressionsConverter(
|
||||
}
|
||||
}
|
||||
|
||||
return Pair(valueParameter, declarationsConverter.convertBlock(blockNode))
|
||||
return Triple(valueParameter, declarationsConverter.convertBlock(blockNode), catchClause.toFirSourceElement())
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user